question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

query params are being escaped but not url encoded which makes `query` useless

See original GitHub issue

See these lines: https://github.com/ronaldschlenker/FsHttp/blob/72f78fd476ddbc1559857be2ef1ef83bc28a7b00/src/FsHttp/Helper.fs#L30-L31

You are escaping the values, but not encoding them. Above there is a function called urlEncode which is not being used.

https://github.com/ronaldschlenker/FsHttp/blob/72f78fd476ddbc1559857be2ef1ef83bc28a7b00/src/FsHttp/Helper.fs#L9

I am trying with fields[member]. If passed as is, the API complains that I need to encode [ and ], but when I do HttpUtility.UrlEncode "fields[member]" I get an error saying “Unknown parameter”. If I add the query param in the GET url with HttpUtility.UrlEncode "fields[member] then it works.

I’ll send a PR if that is ok with you.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
RonaldSchlenkercommented, Sep 11, 2021

Thanks for your support!

1reaction
mabasiccommented, Sep 10, 2021

I am using 6.0.0-preview1 and it works now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do some query strings work even if parameters are not ...
The url parameter, http://journals.plos.org/plosone/s/file?id=wjVg/PLOSOne_formatting_sample_main_body.pdf , is not encoded. It contains ...
Read more >
URL escape before inserting user data into HTML ...
We can do this because key HTML special characters are not escaped by URL encoding. Query Parameter Injection. Let's assume we have perfect...
Read more >
urlencode - Manual
This function is convenient when encoding a string to be used in a query part of a URL, as a convenient way to...
Read more >
urllib.parse — Parse URLs into components — Python 3.11.4 ...
The components are not broken up into smaller parts (for example, the network location is a single string), and % escapes are not...
Read more >
Incomplete string escaping or encoding - CodeQL - GitHub
However, directly using the string replace method to perform escaping is notoriously error-prone. Common mistakes include only replacing the first occurrence of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found