usebruno / bruno

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

Cannot send two values with the same key with Form URL Encoded #2426

Open lohfu opened 2 weeks ago

lohfu commented 2 weeks ago

I have checked the following:

Describe the bug

If you define two values with the same key, only the last key will be sent.

My current use case for this is testing the api for form that has multiple checkboxes with the same name.

.bru file to reproduce the bug

No response

Screenshots/Live demo link

Bruno

Sending image results in image

Postman

Sending image results in image

hunxjunedo commented 2 weeks ago

it doesn't seem to be a bug, it is intended, it is not theoretically possible for for an object to have same keys, keys are supposed to be unique. You can try a workaround, like use an index with the key.

pietrygamat commented 2 weeks ago

It is a bug with non-theoretical repercussions :) . It was reported already as #2192 (with potential fix down the line).

inimicus commented 2 weeks ago

Have you tried what[] as the name of both keys? Does that give you what you're looking for?

lohfu commented 2 weeks ago

@hunxjunedo i am pretty sure the http spec allows one key to have several values. It isn't a regular object, more a key/value string. Setting multiple values for a query param works fine in Bruno, and Form URL Encoded essential;y encodes data exactly the same way as a query string.