什么是“406-不可接受的响应"?在 HTTP 中? [英] What is "406-Not Acceptable Response" in HTTP?
问题描述
在我的 Ruby on Rails 应用程序中,我尝试通过 REST 客户端上传图像http://en.wikipedia.org/wiki/Base64">Base64 格式.当我发布图像时,我收到 406 Not Acceptable Response.当我检查我的数据库时,图像在那里并成功保存.
这个错误的原因是什么,我需要在我的标题中指定什么吗?
我的要求:
URL --- http://localhost:3000/exercises.json
标题:
Content-Type - application/json
原始数据:
<代码>{锻炼": {subbodypart_ids":["1",2"],"name": "练习 14"},"image_file_name": "上面的压力条.jpg","图像":"*****base64 格式*******"}
您的操作没有失败.
您的后端服务说它返回的响应类型未在您的客户端请求的 Accept HTTP 标头中提供.
参考:http://en.wikipedia.org/wiki/List_of_HTTP_header_fields
- 找出服务返回的响应(内容类型).
- 在您的请求接受标头中提供此(内容类型).
http://en.wikipedia.org/wiki/HTTP_status_code -> 406>
In my Ruby on Rails application I tried to upload an image through the POSTMAN REST client in Base64 format. When I POST the image I am getting a 406 Not Acceptable Response. When I checked my database, the image was there and was successfully saved.
What is the reason for this error, is there anything I need to specify in my header?
My request:
URL --- http://localhost:3000/exercises.json
Header:
Content-Type - application/json
Raw data:
{
"exercise": {
"subbodypart_ids": [
"1",
"2"
],
"name": "Exercise14"
},
"image_file_name": "Pressurebar Above.jpg",
"image":"******base64 Format*******"
}
Your operation did not fail.
Your backend service is saying that the response type it is returning is not provided in the Accept HTTP header in your Client request.
Ref: http://en.wikipedia.org/wiki/List_of_HTTP_header_fields
- Find out the response (content type) returned by Service.
- Provide this (content type) in your request Accept header.
http://en.wikipedia.org/wiki/HTTP_status_code -> 406
这篇关于什么是“406-不可接受的响应"?在 HTTP 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!