在restfull WS中,如何告诉客户端仅发送csv和文本格式文件。
在 content-type
header 中,客户端设置发送请求的格式,在 Accept
header 中,客户端设置要接受响应的格式。
但是如何告诉客户端仅发送 content-type
csv 或文件?这是通过一些文档吗?
最佳答案
415
状态码似乎适合这种情况:
The
415
(Unsupported Media Type) status code indicates that the origin server is refusing to service the request because the payload is in a format not supported by this method on the target resource. The format problem might be due to the request's indicatedContent-Type
orContent-Encoding
, or as a result of inspecting the data directly.
响应负载可以包含服务器支持的媒体类型列表。
关于java - REST:告诉客户端仅发送 csv 和文本格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54072518/