简体   繁体   English

如何使用Bubblewrap HTTP设置内容类型?

[英]How do I set Content-type using Bubblewrap HTTP?

I'm trying to post a request with content-type: application/x-www-form-urlencoded. 我正在尝试发布内容类型为:application / x-www-form-urlencoded的请求。 But when I view the request with Charles (or Fiddler) it says application/json. 但是当我与Charles(或Fiddler)一起查看请求时,它显示为application / json。

        HTTP.post(url, 
            {
                :headers => {"Content-Type" => "application/x-www-form-urlencoded"}
            }) do |response| 
            puts response
            puts response.body.to_str
        end
BW::HTTP.post("http://foo.bar.com/", {payload: data, headers: {"Content-Type": "application/x-www-form-urlencoded"} }) do |response|

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AFNetworking:如何在请求中设置Content-Type HTTP标头? - AFNetworking: How to set Content-Type HTTP Header in request? 如何在AFnetworking中设置内容类型 - How to set content-type in AFnetworking 如何在AFNetworking中设置Content-Type? - How to set Content-Type in AFNetworking? 如何访问 NSHTTPURLResponse 的“Content-Type”标头? - How can I access the "Content-Type" header of an NSHTTPURLResponse? 设置了正确的内容类型,但 .ipa 文件被视为 .zip 文件 - The correct content-type is set, but i the .ipa File is treated like a .zip File 如何在 Nginx/Rails 上为 apple-app-site-association 文件设置正确的内容类型 - How to set correct content-type for apple-app-site-association file on Nginx/Rails iOS和Node:将内容类型设置为application / json的正确方法 - iOS and Node: Correct way to set content-type to application/json 没有使用内容类型的应用程序/ JSON iOS获得JSON响应 - Not getting JSON response using content-type application/JSON iOS NSURLSession和Content-Type问题 - Issue with NSURLSession and Content-Type Swift-4:如何使用带有“Content-Type”的 URLSession 参数的 POST 请求获取数据:“application/x-www-form-urlencoded” - Swift-4 : How to fetch data using POST request with Parameters in URLSession with "Content-Type" : "application/x-www-form-urlencoded"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM