gpt4 book ai didi

json - HTTP 中的 "406-Not Acceptable Response"是什么?

转载 作者:太空宇宙 更新时间:2023-11-04 10:53:48 27 4
gpt4 key购买 nike

在我的 Ruby on Rails 应用程序中,我尝试通过 POSTMAN REST 上传图像客户在Base64格式。当我发布图像时,我收到 406 Not Acceptable 响应。当我检查数据库时,图像就在那里并且已成功保存。

此错误的原因是什么,我需要在 header 中指定什么吗?

我的要求:

URL --- http://localhost:3000/exercises.json

标题:

Content-Type  -  application/json

原始数据:

{
"exercise": {
"subbodypart_ids": [
"1",
"2"
],
"name": "Exercise14"
},
"image_file_name": "Pressurebar Above.jpg",
"image":"******base64 Format*******"
}

最佳答案

您的操作没有失败。

您的后端服务表示,您的客户端请求中的 Accept HTTP header 中未提供它返回的响应类型。

引用号:http://en.wikipedia.org/wiki/List_of_HTTP_header_fields

  1. 找出服务返回的响应(内容类型)。
  2. 在您的请求 Accept header 中提供此内容(内容类型)。

http://en.wikipedia.org/wiki/HTTP_status_code -> 406

关于json - HTTP 中的 "406-Not Acceptable Response"是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47513638/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com