什么是" 406 - 不接受的反应"在HTTP? [英] What is "406-Not Acceptable Response" in HTTP?
问题描述
在我的Ruby on Rails应用我试图通过邮递员 REST 在客户端上传图片< A HREF =http://en.wikipedia.org/wiki/Base64> Base64的格式。当我发布图片我得到一个的 406不可接受响应的。当我检查我的数据库,影像在那里,已成功保存。
什么是这个错误的原因,有什么我需要在我的头,用于指定?
我的要求:
网址--- 的http://本地主机:3000 / exercises.json
标题:
内容类型 - 应用程序/ JSON
原始数据:
{
锻炼:{
subbodypart_ids:[
1,
2
]
名:Exercise14
},
映像文件:pressurebar Above.jpg
形象:****** Base64格式*******
}
您的操作没有失败。
您后端服务是说,响应类型它返回在接受的HTTP头在客户端请求没有提供。
参考:<一href=\"http://en.wikipedia.org/wiki/List_of_HTTP_header_fields\">http://en.wikipedia.org/wiki/List_of_HTTP_header_fields
- 找到了由服务返回的响应(内容类型)。
- 提供在请求本(内容类型)Accept头。
<一个href=\"http://en.wikipedia.org/wiki/HTTP_status_$c$c\">http://en.wikipedia.org/wiki/HTTP_status_$c$c - > 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
这篇关于什么是&QUOT; 406 - 不接受的反应&QUOT;在HTTP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!