0
我想使用下面的代碼使用akka http客戶端調用Rest API。Akka http客戶端 - URI編碼
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)
通話熄滅前,當我檢查httprequest.uri(通過調試器),還有就是正在發生的部分URI解碼(%2B改變爲+) dj2bQryHPCj4IVrc48xTPD + hswk%2FqNWx + LuUA0G2T6GLnyBVD6wC231IjgDBYJnt
由於此的API返回錯誤。有沒有選擇我們可以讓阿卡不篡改URI?
我試過,但沒有幫助。 uri = Uri.apply(「https://example.com/customers/~/profiles/dj2bQryHPCj4IVrc48xTPD%2Bhswk%2FqNWx%2BLuUA0G2T6GLnyBVD6wC231IjgDBYJnt/preferences」,Uri.ParsingMode.Relaxed), – Leo15