Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: new-request error when create request from cURL if some parameter(s) in form-urlencoded type data missing '=' #2290

Conversation

leonardoyhl
Copy link
Contributor

Description

When create a new form-urlencoded request from cURL, if some parameter(s) in form-urlencoded type data missing =, like param2 parameter below, toast that Error invoking remote method 'renderer:new-request': TypeError: Cannot read properties of null (reading 'includes'). #2288

e.g.:

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

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

Contribution Checklist:

  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

…r(s) in form-urlencoded type data missing '='
@leonardoyhl leonardoyhl changed the title fix: new-request error when create request from cURL if some parameter(s) in form-urlencoded type data missing '=' (#2288) fix: new-request error when create request from cURL if some parameter(s) in form-urlencoded type data missing '=' May 11, 2024
@helloanoop helloanoop merged commit 5099a50 into usebruno:main May 22, 2024
@helloanoop
Copy link
Contributor

Merged. Thank you @leonardoyhl !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants