usebruno / bruno

Opensource IDE For Exploring and Testing Api's (lightweight alternative to postman/insomnia)
https://www.usebruno.com/
MIT License
25.6k stars 1.17k forks source link

Repeated application/x-www-form-urlencoded fields only send final field #2594

Open nikclayton opened 2 months ago

nikclayton commented 2 months ago

I have checked the following:

Describe the bug

It's possible to have an application/x-www-form-urlencoded POST request that has multiple fields with the same name.

For example, https://docs.joinmastodon.org/methods/filters/#create.

If you try and do this in Bruno only the last field value is sent.

To reproduce:

  1. Create a new request
  2. Set the method to POST, the url to https://mastodon.social/api/v2/filters
  3. Set the body to "Form URL Encoded"
  4. Add two items, both with name data[], set the value of the first to one, the second to two.
  5. Send the request
  6. The request will fail because you're not authorised.
  7. Open the "Timeline" tab in the UI

You'll see the request was data%5B%5D=two.

It should be data%5B%5D=one&data%5B%5D=two.

.bru file to reproduce the bug

meta { name: filter test type: http seq: 2 }

post { url: https://mastodon.social/api/v2/filters body: formUrlEncoded auth: none }

body:form-urlencoded { data[]: one data[]: two }

Screenshots/Live demo link

N/A

Arcane52689 commented 3 weeks ago

Have experienced this issue as well. Sending data[0], data[1] is not viable in rails, as it interprets that as a hash instead of an array.