insomnia icon indicating copy to clipboard operation
insomnia copied to clipboard

[BUG] Empty parameters are sent without the equal sign for x-www-form-urlencoded requests

Open voidmain opened this issue 9 years ago • 10 comments

Overview

  • Insomnia Version: 5.0.10
  • Operating System: MacOS 10.12.5
  • Summary: Empty parameters are sent without an equal sign for x-www-form-urlencoded requests. The specification allows for empty parameters as long as they have an equals sign after the parameter name

How To Reproduce

  1. Install a simple echo server like Node http-echo-server and start it up
  2. Create new POST request with body type Form URL Encoded
  3. Add parameter named foo with no value
  4. Execute the request and notice that the body output in the echo server is foo rather than foo=

voidmain avatar May 29 '17 16:05 voidmain

Thanks for reporting this @voidmain. I just pushed a fix for this on #265.

gschier avatar May 29 '17 17:05 gschier

@gschier

Hello, I am still experiencing this bug.

Ubuntu 17.04 Insomnia 5.7.12

image

curtisbelt avatar Aug 14 '17 20:08 curtisbelt

Hi @voidmain, thanks for reporting!

This is not quite the same bug you mentioned before since that was the request body and your screenshot is of the query string. Did you mean to be using the Body tab?

Omitting = sign in the query string is an implementation choice. It is quite common for HTTP clients/servers to omit the equal sign for empty parameters.

gschier avatar Aug 14 '17 21:08 gschier

That being said, it might be worth adding a checkbox or toggle somewhere to change this behavior

gschier avatar Aug 14 '17 21:08 gschier

@gschier Oops, it's me who added additional comments, not voidmain. I misunderstood his original bug report.

We're going to update our API to allow no equal sign since that's more common to be accepted, like you pointed out.

You can disregard this! Thank you.

curtisbelt avatar Aug 14 '17 21:08 curtisbelt

Woops, I wasn't paying close enough attention. Glad you got it sorted out @CurtisBelt! 😄

gschier avatar Aug 14 '17 21:08 gschier

Hello! I've the same issue with a GET call. The empty parameters are being sent without the equal sign and the API that I'm working on throws me a 400 error because of this. Do we have any solution for this?

gonzalo-calandria avatar Feb 26 '19 19:02 gonzalo-calandria

I'm facing the same issue. APIs can treat the parameter as a boolean rather than a string due to the missing =. As @gschier said, if this can be an optional toggle (per request, or per parameter like Paw does) that would be fantastic.

erkattak avatar May 03 '22 16:05 erkattak

I'm having the exact same problem: The server I'm sending my request to, doesn't recognize query parameters when they aren't followed by equal signs.

It would be very cool, if we could toggle this behaviour somewhere in the App's settings.

strzyzewski avatar Aug 24 '22 17:08 strzyzewski

ASP.NET does insomnia fails but curl work

Naist4869 avatar Jan 23 '23 16:01 Naist4869