繁体   English   中英

HTTP POST内容类型

[英]HTTP POST Content-Type

我有这个HTTP POST服务:

POST /test/test.asmx/getValues HTTP/1.1
Host: localhost
Content-Type: application/x-www-form-urlencoded
Content-Length: length

xmlstr=string

我想要这项服务:

POST /test/test.asmx/getValues HTTP/1.1
Host: localhost
Content-Type: application/xml
Content-Length: length

xmlstr=string

如何将Server的Content-Type值更改为application / xml 我正在使用IIS和VB .NET。

谢谢。

Content-Type请求标头描述了请求Content-Type中的数据格式。

xmlstr=string使用application/x-www-form-urlencoded格式application/x-www-form-urlencoded

如果您说Content-Type: application/xml那么我希望该正文的格式为XML(例如<xmlstr>string</xmlstr> )。

您发送到服务器的Content-Type对服务器响应的数据类型没有标准化的影响。

Accept标头可以请求特定的内容类型:

POST /test/test.asmx/getValues HTTP/1.1
Host: localhost
Accept: application/xml
Content-Type: application/x-www-form-urlencoded
Content-Length: length

xmlstr=string

…但是服务器端代码必须注意并尊重它。

服务器还可能允许使用非标准的请求标头,URL的查询字符串中存储的数据或正文中的数据来请求特定格式。

这将始终取决于服务器端代码支持的内容。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM