开发者

How do I know what's the right Content-type to use when sending XML data using HTTPS POST?

Is it "application/x-www-form-ur开发者_运维知识库lencoded", "multipart/form-data", "application/xml", "text/xml" or something else? And more importantly, how do I know when to use which?

This is a very old article which says to use "multipart/form-data" and that "application/x-www-form-urlencoded" is bad. Is that still valid advice? http://skew.org/xml/misc/xml_vs_http/#post

I'm not really using a framework - I want to hand-code this as much as possible.

Cheers!


It depends how you are encoding the data. You could use any of those (under the right circumstances).

If you are serving up XML as the message body without doing any other encoding on it, then you probably want application/xml.

The article has an example and mentions (with some almost decade old examples) that this is problematic if the server side processor doesn't support it.

If you are writing said processor, then you just have to make sure that you write it so that it does.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜