Repository navigation
Conversation
|
Had a quick skim of the logs, looks like it failed because of a network issue:
|
|
|
||
| pub fn urlencode<T: AsRef<str>>(s: T) -> String { | ||
| ::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect() | ||
| ::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect::<String>().replace("+", "%20") |
There was a problem hiding this comment.
thanks for the PR. what about using https://docs.rs/percent-encoding/latest/percent_encoding/ instead ?
There was a problem hiding this comment.
I considered this but was unsure if an additional dependency would be preferable. It seems like the more robust solution, so I'll revise shortly.
There was a problem hiding this comment.
I've updated the PR to use percent_encoding, and modified accordingly per review comments.
There was a problem hiding this comment.
All reported issues were addressed across 50 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
This PR fixes path parameter space encoding by modifying the urlencode fn to use percent-encoding in reqwest and reqwest-trait. They were originally sent as
+as opposed to%20.To more closely match previous behaviour, everything except unreserved characters is encoded, RFC3986 refers.
I've also added percent-encoding to Cargo.toml (incl. manually maintained ones), a codegen test and regenerated the samples.
Fixes #25257.
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
@frol @farcaller @richardwhiuk @paladinzh @jacob-pro @dsteeley
Summary by cubic
Fixes a bug in the generated Rust
reqwestandreqwest-traitclients where spaces in path parameters were encoded as+instead of%20, breaking URL paths with spaces.urlencodehelper'sform_urlencoded::byte_serializeimplementation withpercent_encoding::utf8_percent_encode, using aPATH_ENCODING_SETthat percent-encodes all reserved characters per RFC3986 while keeping unreserved characters (-,.,_,~) untouched. This preserves the previous encoding behavior for other reserved characters while fixing spaces.percent-encodingdependency to generatedCargo.tomlfiles, a codegen test covering both libraries, and regenerated samples.Written for commit fc4a3f7. Summary will update on new commits.