Open Volcanon- opened 7 years ago
Alright I debugged a bit and got this to work. The root cause is this code: var returnedData = JSON.parse(html);
This code is attempting to parse the response. If I send formatted JSON, it will attempt to reparse and fail. This is at odds with the information supplied here, which suggests that I need to supply a JSON object:
https://github.com/cmunk/utopiaintel/blob/master/example.php#L33
This explains why you do not supply an accept header, as I mentioned here: https://github.com/cmunk/utopiaintel/issues/2, since if you did, the content may get marshaled into the wrong type.
In my case, the resolution was to send a TEXT_PLAIN response and let Utopia parse the string out.
I'd recommend clarifying the guide that it should be a string or string-like and not a JSON object.
You'll have to excuse some of my ignorance as I'm not the best web developer, but I think I've got the right type of response coming back to the server, but still am getting "Something is wrong with your endpoint"
Here's a sample response my server is delivering.