xmlhttprequest responsetext coming for Accept header: text/xml , but server error for application/JS
Posted
by encryptor
on Stack Overflow
See other posts from Stack Overflow
or by encryptor
Published on 2010-05-13T06:43:00Z
Indexed on
2010/05/13
6:54 UTC
Read the original article
Hit count: 211
I have to get response text from a resourceindex page as JSON object. When I dont put a Accept header in the request, it shows me the xml response (i see it in an alert)..
But I want the response as a JSON object.. What should I do. One solution would have been
httpRequest.setRequestHeader('Accept', 'application/JSON');
but this gives me a server error :500
Also it says
A message body writer for Java type, class ...., and MIME media type, application/octet-stream, was not found
Can someone suggest on what to do to overcome this and get the response as JSON?
© Stack Overflow or respective owner