usebruno / bruno

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

Error with URL encoded form data #3129

Closed mattisebastian closed 1 week ago

mattisebastian commented 1 week ago

I have checked the following:

Describe the bug

Hi, I imported my first request from Insomnia to Bruno. It contains a URL encoded form. When sending the request I receive the following error:

Error invoking remote method 'send-http-request': TypeError: Cannot read properties of undefined (reading 'formSerializer')

I tried manually removing the fields and adding them again, with the same error outcome.

Bug https://github.com/usebruno/bruno/issues/2107 seems similar but trying to read a different property.

Let me know if further input is needed.

Best regards Matti

.bru file to reproduce the bug

No response

Screenshots/Live demo link

Screenshot 2024-09-18 at 12 40 59
mattisebastian commented 1 week ago

Manually adding the body as Form URL Encoded works.

mjhcorporate commented 1 week ago

Interesting! I think I have seen this error as well. Can you post the .bru that shows this issue? I wonder if it is corrupted in some way...

mattisebastian commented 1 week ago

How can I see the .bru file?

On Wed, 18 Sept 2024 at 13:36, Martin Hoecker @.***> wrote:

Interesting! I think I have seen this error as well. Can you post the .bru that shows this issue? I wonder if it is corrupted in some way...

— Reply to this email directly, view it on GitHub https://github.com/usebruno/bruno/issues/3129#issuecomment-2358231402, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAV6YGBRSUYT6XKNK6Y2DS3ZXFQVHAVCNFSM6AAAAABONMLV6WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJYGIZTCNBQGI . You are receiving this because you authored the thread.Message ID: @.***>

-- Viele Grüße Matti Leydecker

mattisebastian commented 1 week ago

How can I see the .bru file?

Found it in the file system:

  name: Get Token Technical user
  type: http
  seq: 5
}

post {
  url: URL
  body: text
  auth: none
}

headers {
  Content-Type: application/x-www-form-urlencoded
  User-Agent: insomnia/8.4.5
  Authorization: Basic Bearertoken
}

body:text {
  grant_type=password&response_type=token&username=user&password=pw
}

body:form-urlencoded {
  ~grant_type: password
  ~response_type: token
  ~username: user
  ~password: pw
}

I see one potential issue already: Both Username & Password contain special characters in my case.

enricojonas commented 1 week ago

Running into the same issue (suddenly, no change in request). So my guess is that this was introduced with the latest version 1.29. Just rolled back to 1.28 and it's working again.

mjhcorporate commented 1 week ago

I can reproduce the error. This is the simplified request that shows the error behavior:

meta {
  name: Form Url Test
  type: http
  seq: 2
}

post {
  url: http://localhost:12345
  body: formUrlEncoded
  auth: none
}

headers {
  Content-Type: application/x-www-form-urlencoded
}

body:form-urlencoded {
  test: test
}

When you remove the header (or disable it), then it works.

You don't need to manually specify the content-type header, it is automatically added. So removing the header could be a good workaround for you.

However, the bug should still be fixed.

mattisebastian commented 1 week ago

Would love to understand how to fix this kind of bug, basically learn where the logic lies to create the header and why it lets the request fail.

helloanoop commented 1 week ago

We just released a patch fix v1.29.1 that should have fixed this issue. Can you please test.

JohnnyTripod commented 1 week ago

Yep, fixed. Thank you for the quick action.

vinodsantharam commented 1 week ago

We just released a patch fix v1.29.1 that should have fixed this issue. Can you please test.

Thanks @helloanoop ❤️

enricojonas commented 1 week ago

Working for us also, thank you :heart: