我使用httpkit作为 http 客户端。我尝试了许多解决方案来制作标题Content-Type
,application/json
但都失败了。
这是我的代码:
(require '[org.httpkit.client :as http])
(http/post
url
{ :query-params {"q" "foo, bar"}
:form-params {"q" "foo, bar"}
:headers {"Content-Type" "application/json; charset=utf-8"}})
使用上面的代码发布会得到response status 200
but Content-Type
is application/x-www-form-urlencoded
。
而如果删除该行application/x-www-form-urlencoded
,就会得到response status 400
。
PS:我将flask作为网络服务器。