通用消息头中的Accept参数代表什么?如何设置呢?快技术达人帮个忙呗?

ChinaUnicom2015 2015-05-05 03:14:52
通用消息头中的Accept参数代表什么?需要如何设置?
...全文
2699 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
ChinaUnicom2015 2015-05-08
  • 打赏
  • 举报
回复
Accept期望返回的响应消息体内容格式类型。 格式如下: Accept: application/json或text/xml 如果请求消息中未指定,则响应消息与请求消息类型尽量保持一致。 如果服务端不能支持所请求的消息类型,则返回HTTP 406错误。
天行归来 2015-05-06
  • 打赏
  • 举报
回复
Summary Specifies the media types accepted in a HTTP response. Description Accept is a String property that specifies the media types that are acceptable in a resulting HTTP response, and can be used to limit the request to a small set of desired types. If no Accept header field is present, then it is assumed that the client accepts all media types. Accept is composed of the media type, subtype, and optional parameters. The asterisk "*" character is used to group media types into ranges, with "*/*" indicating all media types and "type/*" indicating all subtypes of that type. Each media type and subtype may include one or more parameters, beginning with the "q" parameter that indicates the relative quality factor. Quality factors allow the user agent to determine the relative degree of preference for that media type and subtype, using the qvalue scale from 0 to 1. The default value is q=1. Accept is updated in the ProcessHeaders method. Accept is used in SetHeaders to read the header values for the request. The default value for Accept is set to 'text/html, */*' when the Clear method is called. Example ARequestHeaderInfo.Accept := 'audio/*; q=0.2, audio/basic'; ARequestHeaderInfo.Accept := 'text/plain; q=0.5, text/html';

170

社区成员

发帖
与我相关
我的任务
社区描述
应用内计费、短信API、话费支付、移动支付、计费SDK、二维码API、计费API、计费接口、wo+开放平台、wo+能力共享平台、wo+梦工厂、联通能力开放
社区管理员
  • 联通WO+开放平台社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧