Kong / Kong/insomnia

Escaped characters in environment variables are not escaped in requests

Open
#4,389 3 comments 0 reactions 0 assignees View on GitHub
A-encoding B-bug E-good-first-issue S-verified
Dominant language
TypeScript
Stars
40k
Forks
2.4k
Avg merge
2d 13h
Merged PRs (30d)
61

Description

### Expected Behavior

With the following environment:
```json
{
"backslash": "\\"
}
```
And the following request body:
```json
{
"from variable": "{{ _.backslash }}",
"from raw text": "\\"
}
```
The request body that is sent should be:
```json
{
"from variable": "\\",
"from raw text": "\\"
}
```

### Actual Behavior

The request body that is actually sent is:
```json
{
"from variable": "\",
"from raw text": "\\"
}
```

### Reproduction Steps

1. Go to https://webhook.site and copy your unique URL to clipboard
2. Use this URL in a new request in Insomnia
3. Define this environment:
```json
{
"backslash": "\\"
}
```
4. Define this JSON request body:
```json
{
"from variable": "{{ _.backslash }}",
"from raw text": "\\"
}
```
5. Send the request
6. Go back to https://webhook.site and observe the raw content of the request you just sent

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

_No response_

### Insomnia Version

2021.7.2

### What operating system are you using?

Other Linux

### Operating System Version

Arch Linux

### Installation method

[insomnia-bin](https://aur.archlinux.org/packages/insomnia-bin/) package from AUR

### Last Known Working Insomnia version

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue using the webhook.site request, the shown environment variable, and JSON request body, then trace how the variable is interpolated before the request is sent. Done means the variable-based backslash is transmitted with the same escaping as the equivalent raw JSON text.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
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.