FredericS
FredericS

Reputation: 413

Retrieve query parameter with RFC3986 reserved characters not decoded in Tapir/http4s

I'm new to Scala (and thus tapir/http4s) and I would like to get a query parameter with RFC 3986 reserved characters not percent-decoded. Indeed, I'm using some reserved characters as delimiters (namely , and :) but when using

.in(query[String]("pairs"))

(actual type is semantically equivalent to a list of pairs of custom types, with Codec[...] = Codec.string.mapDecode(...) and below query is over-simplified to present minimal reproduction)

with uri /?pairs=1:hello%3Aworld

Value in serverLogic is "1:hello:world", and thus logic based on _.split(":") fails for obvious reasons.

Is it possible to get the query parameter with reserved characters not decoded?

Full disclaimer, I've already complained on the usage of reserved delimiters in values, and for my specific case, I can use indexOf(":") as a workaround as keys are guaranteed to not contain reserved delimiter, so I'm not looking for an alternative solution, but just wandering if what I want is possible with the current state of the libraries.

Upvotes: 2

Views: 119

Answers (0)

Related Questions