Kong / Kong/insomnia

Request render error when using result from other request and expressions like "@{#{test}}" in JSON body

Open
#5,994 0 comments 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

I would like to send JSON request with body like this:

```json
{
"name": "test",
"id": {% response 'body', 'req_ef180b00755e4063aff8a9ff48c2f4ef', 'b64::JC5pZA==::46b', 'never', 60 %},
"body": "@{#{test}}"
}
```

Response already exist in my collection and tag to read body attribute works by itself.

### Actual Behavior

When I define request body as:

```
{
"name": "test",
"id": {% response 'body', 'req_ef180b00755e4063aff8a9ff48c2f4ef', 'b64::JC5pZA==::46b', 'never', 60 %},
"body": "@{#{test}}"
}
```

I'm geeting "Failed to render request" error.

If i change body to either:

```json
{
"name": "test",
"id": {% response 'body', 'req_ef180b00755e4063aff8a9ff48c2f4ef', 'b64::JC5pZA==::46b', 'never', 60 %},
"body": "test"
}
```

or

```json
{
"name": "test",
"id": 1,
"body": "@{#{test}}"
}
```

then it works as expected.

### Reproduction Steps

Just attempt to send JSON request like those mentioned above (ofc, referenced request must also exist)

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

2023.2.0

### What operating system are you using?

macOS

### Operating System Version

13.3.1 (a) (22E772610a)

### Installation method

Download from https://insomnia.rest/download

### Last Known Working Insomnia version

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the request-rendering failure with the referenced response tag and the JSON body containing "@{#{test}}". The issue is done when the combined response reference and expression render and send successfully, while the separately working body variants continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, devtools
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.