Application/json


#1

Hi! I am realtively new to json and such, and got my piston to submit information via a custom post. Works great, my app is receiving the data fine (I’m basically taking what was Fuel Stream info and sending it up to a database where I can keep more than 7 days).

Anyway, like I said, data is working fine, but every so often, I get this error:

8ed7e87a-abc1-4ee8-b4e3-6983f22d4c7b ‎1‎:‎06‎:‎01‎ ‎PM: error ║ Error executing external web request: java.lang.IllegalArgumentException: Response does not have a content-type header @line 3299 (doCall)

It’s not every single time. But it is frequent enough (and red) that I’m worried. Is this something perhaps my json app is not returning correctly? Is this something webcore is doing incorrectly? I really can’t tell, or don’t know, but would love to help contribute by fixing this if I can.

Thanks for all the hard work!


#2

Make sure your app sets the Content-Type header when responding to the web request.


#3

So yeah, the app tells me to be sure to remember to include a content type header set to application/json in my request… and I have set that in the web request as well. So I think I have that right?


#4

Ady was referring to your server, it needs to specify that the response coming back to webCoRE is JSON with a Content-Type: application/json header. If the response is not JSON you will need to use an appropriate content type header (e.g. text/plain) or return a 204 status code to signify that the response is empty.

Your request looks fine to me!