scala - Akka http client - URI encoding -
i trying invoke rest api using akka http client using below code.
val httprequest = httprequest( method = httpmethods.get, uri ="https://example.com/customers/~/profiles/dj2bqryhpcj4ivrc48xtpd%2bhswk%2fqnwx%2bluua0g2t6glnybvd6wc231ijgdbyjnt/preferences", headers = list(accept(mediarange(mediatypes.`application/json`.withparams(map("v" → "3")))), rawheader("content-type", "application/json;v=3"), rawheader("api-key", "xyz") ) )
http().singlerequest(httprequest, gatewayhelper.connectioncontext)
before call goes out, when check httprequest.uri (through debugger), there partial uri decoding happening (%2b changed +) dj2bqryhpcj4ivrc48xtpd+hswk%2fqnwx+luua0g2t6glnybvd6wc231ijgdbyjnt
because of api returning error. there option can make akka not tamper uri?
i have not tried spray
, akka-http
have configuration options modify strictness of uris.
take this: http://doc.akka.io/docs/akka/2.4.10/scala/http/configuration.html#akka-http
the following parameter
sets strictness mode parsing request target uris.
# following values defined: # # `strict`: rfc3986-compliant uris required, # 400 response triggered on violations # # `relaxed`: visible 7-bit ascii chars allowed # uri-parsing-mode = strict
you might want change relaxed
, test again.
Comments
Post a Comment