【发布时间】:2020-02-29 17:48:18
【问题描述】:
Fuel 库 - 无法发送没有默认标头的请求。
我正在尝试发送没有 Content-Type 标头的示例性请求:
Fuel.post("http://endpoint/...")
.also { it.headers.clear() }
.also { log.debug { "Headers: $it.headers" }}
.body("...body...".toByteArray(Charset.ISO_8859_1))
.response { request, response, result -> log.debug { "Response: $response" }}
但在服务器端,它看起来(从服务器日志中读取)该请求是与发送的
Content-type application/x-www-form-urlencoded
客户端的日志并不表明发送了这样的“内容类型”元素:
Headers: --> http://endpoint/...
"Body : (empty)"
"Headers : (0)"
我做错了吗?你有没有发现这样的行为?
使用fuel库时如何不发送Content-type header?
【问题讨论】:
标签: kotlin http-headers httprequest fuel