Merge pull request #225 from mirkogolze/feature/191-interpolate-header-names

#191 interpolate header names with variables
This commit is contained in:
Anoop M D 2023-09-28 04:38:37 +05:30 committed by GitHub
commit 559fcb0806
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 12 deletions

View File

@ -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>

View File

@ -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') {

View File

@ -51,7 +51,7 @@ const template = [
click: () => click: () =>
openAboutWindow({ openAboutWindow({
product_name: 'Bruno', product_name: 'Bruno',
icon_path: join(__dirname, '../../resources/icons/png/256x256.png'), icon_path: join(process.cwd(), '/resources/icons/png/256x256.png'),
homepage: 'https://www.usebruno.com/', homepage: 'https://www.usebruno.com/',
package_json_dir: join(__dirname, '../..') package_json_dir: join(__dirname, '../..')
}) })

View File

@ -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') {