发送“415不支持的媒体类型”时指定支持的媒体类型。 [英] Specify supported media types when sending "415 unsupported media type"

查看:116
本文介绍了发送“415不支持的媒体类型”时指定支持的媒体类型。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果客户端将不支持的媒体类型的数据发送到HTTP服务器,则服务器将回答状态为 415不支持的媒体类型。但是如何告诉客户端支持哪些媒体类型?是否有标准或至少推荐的方法?或者它只是作为文本写入响应主体?

If a clients sends data in an unsupported media type to a HTTP server, the server answers with status "415 unsupported media type". But how to tell the client what media types are supported? Is there a standard or at least a recommended way to do so? Or would it just be written to the response body as text?

推荐答案

对此无法做什么说明案例,所以期望实现到处都是。 (如果服务器的响应包含类似 Accept:标题,那将是明智的,因为如果当前方向错误,那么它具有非常正确的语义。)

There is no specification at all for what to do in this case, so expect implementations to be all over the place. (What would be sensible would be if the server's response included something like an Accept: header since that has pretty much the right semantics, if currently in the wrong direction.)

这篇关于发送“415不支持的媒体类型”时指定支持的媒体类型。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆