4
我正在尋找一種方法來設置用於couchdb響應的Contet-Type
。在CouchDB中設置顯式響應內容類型
我有POST
JSON使用Content-Type
和Accept
請求標頭爲application/json
。但是當我爲該文檔調用GET
時,它返回的JSON響應爲Content-Type
text/plain; charset=utf-8
。我期待的是application/json
,因爲它是Content-Type
。
我該怎麼做?
POST
- 網址:http://localhost:5984/hotel_staticdata
- 請求正文:
{"_id":"test-hotel-stat-data","content":[{"hotelcode": "AMB3_LON","hotelname": "Ambassadors Bloomsbury"},{"hotelcode": "ALE1_LON","hotelname": "Alexandra"},{"hotelcode": "ALE1_LON","hotelname": "Alexandra"}]}
- 請求報頭: 接受:應用/ JSON 內容類型:應用程序/ JSON
GET
- 網址:http://localhost:5984/hotel_staticdata/test-hotel-stat-data
- 響應體:
{"_id":"test-hotel-stat-data","_rev":"3-6c6e26cd5690794886a8dc65308bf078","content":[{"hotelcode":"AMB3_LON","hotelname":"Ambassadors Bloomsbury"},{"hotelcode":"ALE1_LON","hotelname":"Alexandra"},{"hotelcode":"ALE1_LON","hotelname":"Alexandra"}]}
- 響應頭: 的Content-Length:249 內容類型:text/plain的; charset = utf-8
取而代之,我嘗試了PUT,然後GET,但結果是一樣的。
- CouchDB的版本:1.6.1