什么是HTTP中的“406-不可接受的響應”?在我的RubyonRails應用程序中,我試圖通過郵遞員上傳一個圖像休息客戶基準64格式。當我發布圖片時,我得到了一個406不可接受的答復..當我檢查我的數據庫時,圖像就在那里,并成功地保存了下來。造成此錯誤的原因是什么,我的標題中是否有需要指定的內容?我的請求:URLhttp://localhost:3000/exercises.json標題:Content-Type - application/json原始數據:{
"exercise": {
"subbodypart_ids": [
"1",
"2"
],
"name": "Exercise14"
},
"image_file_name": "Pressurebar Above.jpg",
"image":"******base64 Format*******"}
3 回答
吃雞游戲
TA貢獻1829條經驗 獲得超7個贊
406不可接受的是,請求所標識的資源只能根據在請求中發送的接受標頭生成內容特征不可接受的響應實體。
POPMUISE
TA貢獻1765條經驗 獲得超5個贊
def create
post = Post.create params[:post]
respond_to do |format|
format.json { render :json => post }
endenddef create post = Post.create params[:post]) render :json => postend
添加回答
舉報
0/150
提交
取消
