I'm looking for a way to set the Contet-Type for couchdb response.
I have POST a JSON using Content-Type and Accept request headers as application/json. But when I call the GET for that document, it returns the JSON response with Content-Type text/plain; charset=utf-8. What I'm expecting is getting application/json as it's Content-Type.
How can I do this?
POST
{"_id":"test-hotel-stat-data","content":[{"hotelcode": "AMB3_LON","hotelname": "Ambassadors Bloomsbury"},{"hotelcode": "ALE1_LON","hotelname": "Alexandra"},{"hotelcode": "ALE1_LON","hotelname": "Alexandra"}]}
GET
{"_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"}]}
Instead of this, I tried PUT then GET also but the results is same.
I got the answer.
When I call the GET with Accept:application/json request header. It works!
Damn! How did I miss it!
Anyway, If you have any different solution please feel free to post.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With