gpt4 book ai didi

finagle - 在 Finagle 中设置 HTTP GET 参数

转载 作者:行者123 更新时间:2023-12-04 23:03:03 25 4
gpt4 key购买 nike

在 Finagle 中,如何以安全、干净的方式创建带有参数的 HTTP GET 请求?

val request = RequestBuilder()
.url("http://www.example.com/test")
.addParameter("key", "value") // this doesn't exist
.buildGet()
request // should be a GET request for http://www.example.com/test?key=value

最佳答案

您可以使用名称困惑的 Request.queryString :

val request = RequestBuilder()
.url(Request.queryString("http://www.example.com/test", Map("key" -> "value"))
.buildGet()

关于finagle - 在 Finagle 中设置 HTTP GET 参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18222435/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com