haskell-servant / haskell-servant/servant
Query components of custom format
- Dominant language
- Haskell
- Stars
- 2k
- Forks
- 427
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 5
Description
So, I have to deal with an API that receives a query component of this form:
```
custom=123=value
```
It is currently impossible to have these with `servant`, you only get
```
>>> type Test = QueryParam "custom" String :> GetNoContent '[JSON] NoContent
>>> toUrlPiece $ safeLink (Proxy @Test) (Proxy @Test) (Just "123=value")
"?custom=123%3Dvalue"
```
or
```
>>> type Test = QueryParam "custom=123" String :> GetNoContent '[JSON] NoContent
>>> toUrlPiece $ safeLink (Proxy @Test) (Proxy @Test) (Just "value")
"?custom%3D123=value"
```
Both of those are not handled by that service correctly.
So for now I have to resort to raw text URL manipulation :(
At first I was trying to find something to prove that they are using an illegal format for query parameters. But turned out the format is legal. This [StackOverflow answer](https://stackoverflow.com/questions/38809739/why-do-some-query-strings-work-even-if-parameters-are-not-url-encoded/38816380#38816380) mentions:
> Note that the `name=value` format (separated by `&`) in the query component is [just a convention](https://softwareengineering.stackexchange.com/a/260205/63183), not something defined in the specification.
So does that mean that we need to provide means to work with different conventions?
It would certainly help with my problem :)
Contributor guide
Assessment
This issue has not been assessed yet.