#191 interpolate header names with variables

This commit is contained in:
Mirko Golze 2023-09-21 22:17:46 +02:00
parent c0b7dad030
commit 36f9902f2e
3 changed files with 21 additions and 11 deletions

View File

@ -72,19 +72,27 @@ const RequestHeaders = ({ item, collection }) => {
</thead>
<tbody>
{headers && headers.length
? headers.map((header, index) => {
? headers.map((header) => {
return (
<tr key={header.uid}>
<td>
<input
type="text"
autoComplete="off"
autoCorrect="off"
autoCapitalize="off"
spellCheck="false"
<SingleLineEditor
value={header.name}
className="mousetrap"
onChange={(e) => handleHeaderValueChange(e, header, 'name')}
theme={storedTheme}
onSave={onSave}
onChange={(newValue) =>
handleHeaderValueChange(
{
target: {
value: newValue
}
},
header,
'name'
)
}
onRun={handleRun}
collection={collection}
/>
</td>
<td>

View File

@ -51,7 +51,8 @@ const interpolateVars = (request, envVars = {}, collectionVariables = {}, proces
request.url = interpolate(request.url);
forOwn(request.headers, (value, key) => {
request.headers[key] = interpolate(value);
delete request.headers[key];
request.headers[interpolate(key)] = interpolate(value);
});
if (request.headers['content-type'] === 'application/json') {

View File

@ -51,7 +51,8 @@ const interpolateVars = (request, envVars = {}, collectionVariables = {}, proces
request.url = interpolate(request.url);
forOwn(request.headers, (value, key) => {
request.headers[key] = interpolate(value);
delete request.headers[key];
request.headers[interpolate(key)] = interpolate(value);
});
if (request.headers['content-type'] === 'application/json') {