在我的 Ruby on Rails 应用程序中,我尝试通过 POSTMAN 上传图像REST http://en.wikipedia.org/wiki/Representational_State_Transfer客户在Base64 http://en.wikipedia.org/wiki/Base64格式。当我发布图像时,我得到了406 不可接受的响应。当我检查数据库时,图像就在那里并且已成功保存。
这个错误的原因是什么,我需要在标题中指定什么吗?
我的请求:
网址---http://localhost:3000/exercises.json
Header:
Content-Type - application/json
原始数据:
{
"exercise": {
"subbodypart_ids": [
"1",
"2"
],
"name": "Exercise14"
},
"image_file_name": "Pressurebar Above.jpg",
"image":"******base64 Format*******"
}
你的操作没有失败。
您的后端服务说它返回的响应类型未在Accept客户端请求中的 HTTP 标头。
Ref: http://en.wikipedia.org/wiki/List_of_HTTP_header_fields http://en.wikipedia.org/wiki/List_of_HTTP_header_fields
- 找出服务返回的响应(内容类型)。
- 在您的请求接受标头中提供此(内容类型)。
http://en.wikipedia.org/wiki/HTTP_status_code http://en.wikipedia.org/wiki/HTTP_status_code-> 406
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)