Query fromString to unsafeFromString#4581
Query fromString to unsafeFromString#4581hamnis merged 1 commit intohttp4s:series/0.22from hamnis:query-fromString-to-unsafeFromString
Conversation
m-sp
left a comment
There was a problem hiding this comment.
hmm in contrast to path we do not have an interpolator for the query string so I'm a bit more hesitant
| * If parsing fails, the empty [[Query]] is returned | ||
| */ | ||
| def fromString(query: String): Query = | ||
| def unsafeFromString(query: String): Query = |
There was a problem hiding this comment.
If we're calling this unsafe, does it still make sense to quietly return an empty? And might fromString now return an Either?
There was a problem hiding this comment.
I thought about doing that in two steps. first deprecating, then change the return type.
We could however do both in one step.
There was a problem hiding this comment.
I think we'll probably want to reclaim the real name fromString for 0.22 and 1.0, so we should probably just go ahead and do it in the next milestone. But the change could be part of a subsequent PR.
|
@m-sp's point on an interpolator is interesting. I found during the ip4s work that hiding an interpolator when it clashes is really hard! So we should be conservative about the ones we create. Or at least be pretty hopeful nobody else will use the same name. |
m-sp
left a comment
There was a problem hiding this comment.
Is
queryunique enough
most likely not, I'n okay merging this but it is getting a bit hard to just construct a correct uri from scratch. especially without using any unsafe methods. as can be seen in our tests
|
If we had a Uri interpolator which accepted parameters, then we would be in a much better place with regards to uri construction. Using the unsafe constructors are not bad per se, but we cant guarantee that every string is a "blessed" string without going through some parsing step. If you are sure that the string does not contain badness, then its fine. |
|
A good URI interpolator is complicated, but is one of the highest value things we could add right now. |
|
👍, but has some merge conflicts |
No description provided.