ArchGPT / insomnium

Insomnium is a fast local API testing tool that is privacy-focused and 100% local. For testing GraphQL, REST, WebSockets and gRPC. This is a fork of Kong/insomnia
MIT License
3.33k stars 125 forks source link

Cannot POST or PUT with strings containing {{double curly brackets}} #87

Open designbyadrian opened 8 months ago

designbyadrian commented 8 months ago

Expected Behavior

Hello, we're using string replacements in our API, and fields in our JSON data can contain strings with curly brackets.

In the example below, the data looks like this

"name": "{{My First Group}}",

Actual Behavior

Insomnium interprets these as environment variables and blocks me from submitting requests.

What's rendered on screen below:

image

Reproduction Steps

Have JSON data. Make a field a string containing template literal. Try POST or PUT.

Is there an existing issue for this?

Additional Information

No response

Insomnium Version

0.2.2

What operating system are you using?

macOS

Operating System Version

macOS Sonoma

Installation method

Download from GitHub

Last Known Working Insomnium version

No response

CodingMomentum commented 7 months ago

This is actually a nunjucks issue, that I had come across a few months back when using insomnia. It's super counter-intuitive, but if you wrap the whole variable block in single quotes, and then again in {{}}, it will send the whole thing as a literal. In your case it should look something like: {{'{{My First Group}}'}}

It will complain, and insomnia/m will not render it correctly because it's confused, but it should send in the body correctly.