softwaremill / softwaremill/sttp-model
Ability to keep the same form of URI segments after decoding/encoding, as originally given
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 45
- Forks
- 33
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 6
Description
Hi.
I've got rather peculiar case, when I needed for an url to retain in exactly the same way, as it was in the string, because some parts of it are signed. The url contains things like %3D instead of =, etc. When the url is parsed by sttp these things are decoded, and when the request is sent using such Url instance - the url is technically the same from the http standards point of view, but the signature is no longer valid.
I solved this by playing with .pathSegmentsEncoding and .querySegmentsEncoding, so the url was exactly same when sending the request. But the url string is comming from an external API, so I can not be sure, that the url encoding they use would remain the same over time and thing would not break.
Wouldn't it be nice to be able to parse string to Url, bit retain whatever encoding was there? I.e. validate such escapes, but do not decode them. Not a piece of cake though, since we need to retain such infomation somewhere in Url, not to encode such escapes second time when rendering (or %3D would turn into %253D).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how strings are parsed into Url and how pathSegmentsEncoding and querySegmentsEncoding affect rendering. Check where decoded segments are stored and encoded again when sending a request. Done means valid percent escapes can retain their original representation without being decoded or double-encoded, including signed URLs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100