mirror of
https://github.com/usebruno/bruno.git
synced 2025-01-05 05:29:00 +01:00
#191 interpolate header names with variables
This commit is contained in:
parent
c0b7dad030
commit
36f9902f2e
@ -72,19 +72,27 @@ const RequestHeaders = ({ item, collection }) => {
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{headers && headers.length
|
{headers && headers.length
|
||||||
? headers.map((header, index) => {
|
? headers.map((header) => {
|
||||||
return (
|
return (
|
||||||
<tr key={header.uid}>
|
<tr key={header.uid}>
|
||||||
<td>
|
<td>
|
||||||
<input
|
<SingleLineEditor
|
||||||
type="text"
|
|
||||||
autoComplete="off"
|
|
||||||
autoCorrect="off"
|
|
||||||
autoCapitalize="off"
|
|
||||||
spellCheck="false"
|
|
||||||
value={header.name}
|
value={header.name}
|
||||||
className="mousetrap"
|
theme={storedTheme}
|
||||||
onChange={(e) => handleHeaderValueChange(e, header, 'name')}
|
onSave={onSave}
|
||||||
|
onChange={(newValue) =>
|
||||||
|
handleHeaderValueChange(
|
||||||
|
{
|
||||||
|
target: {
|
||||||
|
value: newValue
|
||||||
|
}
|
||||||
|
},
|
||||||
|
header,
|
||||||
|
'name'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
onRun={handleRun}
|
||||||
|
collection={collection}
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -51,7 +51,8 @@ const interpolateVars = (request, envVars = {}, collectionVariables = {}, proces
|
|||||||
request.url = interpolate(request.url);
|
request.url = interpolate(request.url);
|
||||||
|
|
||||||
forOwn(request.headers, (value, key) => {
|
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') {
|
if (request.headers['content-type'] === 'application/json') {
|
||||||
|
@ -51,7 +51,8 @@ const interpolateVars = (request, envVars = {}, collectionVariables = {}, proces
|
|||||||
request.url = interpolate(request.url);
|
request.url = interpolate(request.url);
|
||||||
|
|
||||||
forOwn(request.headers, (value, key) => {
|
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') {
|
if (request.headers['content-type'] === 'application/json') {
|
||||||
|
Loading…
Reference in New Issue
Block a user