Kong / Kong/insomnia

Insomnia plugin always adding a ';' at the end of the string when used in the Headers section

Open
#4,442 1 comment 0 reactions 0 assignees View on GitHub
B-bug S-unverified
Dominant language
TypeScript
Stars
40k
Forks
2.4k
Avg merge
2d 13h
Merged PRs (30d)
61

Description

### Expected Behavior

Insomnia plugin should return the string as is

### Actual Behavior

When i look at the timeline of the request, I see there is a ';' character added at the end.

### Reproduction Steps

Install https://github.com/mageshwaranr/insomnia-plugin-sh-cmd plugin
use "execute a command" option in the bulk edit headers
make a request

### Is there an existing issue for this?

- [X] I have searched the [issue tracker](https://www.github.com/Kong/insomnia/issues) for this problem.

### Additional Information

The plugin is quite simple actually

```
const { promisify } = require('util');
const exec = promisify(require('child_process').exec)

module.exports.templateTags = [
{
displayName: "/bin/sh",
name: "shCmdExec",
description:
"Executes given command using child_process package, basically /bin/sh cmd",
args: [
{
displayName: "Type",
type: "enum",
options: [
{
displayName: "Execute command returning String value",
value: "string",
},
{
displayName: "Execute command returning JSON value",
value: "json",
},
],
},
{
displayName: "Command/shell to be executed",
help: 'Executes the given command using require("child_process").exec command',
type: "string",
},
],
async run(context, type = "string", cmd) {
try {
var resp = await exec(cmd)
} catch (failed) {
console.log("Command execution failed with " + failed)
return failed.stderr
}

if (type == "json") {
return JSON.parse(resp.stdout.trim()) // add test case
}
return resp.stdout.trim()
},
},
]
```
If I copy/paste the values from the live preview field, it works, but not as a variable.

### Insomnia Version

2021.7.2

### What operating system are you using?

macOS

### Operating System Version

Macos Big Sur 11.6.3

### Installation method

homebrew

### Last Known Working Insomnia version

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the insomnia-plugin-sh-cmd template tag in bulk-edit Headers, then compare the live preview with the request shown in the timeline. Trace the template-tag value through request construction and verify that the header value remains unchanged when the request is sent.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, shell
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.