如何删除“SOAPAction”来自 Savon 请求的 HTTP 标头
例如,我如何从 Savon 请求中删除 HTTP 标头
client.request 'v5:ProcessShipments' do
client.http.headers["SOAPAction"] = "example_post"
end
这将生成
DEBUG -- : SOAPAction: example_post
并且服务器将响应
Server did not recognize the value of HTTP Header SOAPAction: example_post.
但是我不想有任何 SOAPAction
我已尝试清除变量并将其删除。我搜索了一段时间,找不到任何东西,所以我希望以前没有人问过这个问题。
提前致谢。
如果我不覆盖它,那么默认情况下 Savon 将使用 client.request 'v5:ProcessShipments',这也是不正确的。
How would I remove the HTTP headers from a Savon request for example
client.request 'v5:ProcessShipments' do
client.http.headers["SOAPAction"] = "example_post"
end
This would generate
DEBUG -- : SOAPAction: example_post
And the server would respond
Server did not recognize the value of HTTP Header SOAPAction: example_post.
However I dont want to have any SOAPAction(s)
I have tried to clear the variable and delete it. I search for a while and couldn't find anything so I hope this hasn't been asked before.
Thanks in advance.
If I dont override it then by default Savon will use the client.request 'v5:ProcessShipments', which is also incorrect.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下是 savon 文档 的引用,供将来参考:
通过阅读 savon 源代码,我发现 Savon::Client#request 方法在生成块之前自动设置“SOAPAction”标头。我尝试删除 SOAPAction 标头,它成功了:
这是它生成的请求:
正如您所看到的,没有 SOAPAction HTTP 标头。
华泰
Here is a quote from savon documentation for the future references:
By reading savon source code I figured out that Savon::Client#request method sets "SOAPAction" header automatically before it yields a block. I tried to delete SOAPAction header and it worked:
Here is the request it generates:
As you can see there is no SOAPAction HTTP header.
HTH