bruno icon indicating copy to clipboard operation
bruno copied to clipboard

Error invoking remote method 'renderer:new-request': TypeError: Cannot read properties of null (reading 'includes'), when create `form-urlencoded` request from cURL

Open leonardoyhl opened this issue 1 year ago • 1 comments

I have checked the following:

  • [X] I use the newest version of bruno.
  • [X] I've searched existing issues and found nothing related to my issue.

Describe the bug

v1.17.0 on MacOS 10.15.7 When create a new form-urlencoded request from cURL, toast that Error invoking remote method 'renderer:new-request': TypeError: Cannot read properties of null (reading 'includes').

.bru file to reproduce the bug

No response

Screenshots/Live demo link

image

How to reproduce the problem?

Some parameter(s) in form-urlencoded type data missing =, like param2 parameter below. e.g.:

curl 'https://example.com/api' \
  -H 'content-type: application/x-www-form-urlencoded' \
  --data-raw 'param1=1&param2'

leonardoyhl avatar May 11 '24 10:05 leonardoyhl

Why?

  1. When parsing cURL command, app will use query-string to parse form-urlencoded type data string. If some parameter(s) in form-urlencoded type data string missing =, query-string will set value as null(Missing = should be null · sindresorhus/query-string). image image

But it isn't a bug, just a feature following W3 specification(https://www.w3.org/TR/2012/WD-url-20120524/#collect-url-parameters). image

  1. When convert json to bru type data in bruno-lang v2, will execute value.includes('\n');, then throw error. image

leonardoyhl avatar May 11 '24 11:05 leonardoyhl

I have merged the PR @leonardoyhl ! Thanks for taking time to go through the W3 spec and make these fixes in Bruno!

This will get shipped in the release scheduled to go out today.

helloanoop avatar May 22 '24 13:05 helloanoop