bruno icon indicating copy to clipboard operation
bruno copied to clipboard

Form URL Encoded requests do not expand variables to their value

Open rignicat opened this issue 1 year ago • 4 comments

Similar to #148

Query: Screenshot 2024-04-04 at 15 52 49

Timeline output: Screenshot 2024-04-04 at 15 57 21

rignicat avatar Apr 04 '24 13:04 rignicat

Hey @RInverid, are you still having the same issue? Also, could you let me know the version of Bruno you were using when the issue occurred?

sanjai0py avatar Apr 10 '24 12:04 sanjai0py

Hi @sanjai0py , I can't reproduce this issue, but I'm sure I was on the latest version, I only just started using Bruno. Very odd, I will close this ticket and hopefully this issue will not return. thank you

rignicat avatar Apr 11 '24 07:04 rignicat

Update: I managed to reproduce it, on version 1.13.1 (latest)! my secret variable has the character " in it, which causes this issue @sanjai0py .

bru file: repro.bru.txt

rignicat avatar Apr 17 '24 13:04 rignicat

I'm seeing this bug on latest Bruno (v1.31, released yesterday). Hovering shows the value that should be interpolated, see screenshot.

Screenshot 2024-10-01 at 08 34 47

matthewb531 avatar Oct 01 '24 06:10 matthewb531

I did some local debugging of this and found that the problem was that I used my own Content-Type header (set in the headers tab) and not relying on the one provided by Bruno.

In interpolate-vars.js the vars are only expanded properly if the header is an exact match of application/x-www-form-urlencoded.

In my case I had set the header to be application/x-www-form-urlencoded; charset=utf-8; which did not match.

Now that I know why it happened, it's no longer an issue for me. But I wonder if a more robust solution would be to match against the internal request.mode instead of the content type to allow for custom headers.

@sanjai0py

bernljung avatar Dec 04 '24 10:12 bernljung

Although the main issue logged is resolved I was able to reproduce the scenario where interpolation breaks on content-type change. This happens for multipart form and form-url-encoded body

Image

anusree-bruno avatar Jul 30 '25 10:07 anusree-bruno