簡體   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