https://kotlinlang.org logo
#ktor
Title
# ktor
p

paw

07/25/2022, 6:18 PM
Hi Is there any way to change the way Ktor encodes spaces in query parameters? By default, it encodes spaces as
+
in query parameters, which I understand is the general convention. However, the API I have to work with is not particularly well-designed, and so it only accepts
%20
as a space, even in query parameters. Is there any way I can tell Ktor to always encode spaces as
%20
no matter the context? The only solution I’ve found so far is
.encodeURLParameter(spaceToPlus = false)
, but that doesn’t seem to be able to apply to globally apply that property in the ktor instance, as one might do with a user agent, it has to be done manually every time. Is there a better way?
10 Views