【发布时间】:2019-10-07 19:48:21
【问题描述】:
例如,在 RestClient 控制台中:
RestClient.post 'http://localhost:5001', {:a => 'b'}, :content_type => 'application/json'
这不会发送 application/json 作为内容类型。相反,我看到:
Content-Type: application/x-www-form-urlencoded
我能够追踪到 restclient/payload.rb 的更改:
class UrlEncoded < Base
...
def headers
super.merge({'Content-Type' => 'application/x-www-form-urlencoded'})
end
end
将 super.merge 替换为 super 会导致内容类型受到尊重,但显然这不是一个真正的解决方案。有谁知道解决这个问题的正确方法?谢谢。
【问题讨论】:
标签: ruby rest-client