The Accept header tells the server what type of response it should send back. It should not be set to match the request type, but that is the default behavior. Fortunately we can override SmartThings’ default.
Think about a fast food drive-thru – your expectation is to give money and receive food, right? SmartThings wants to receive money because money was given. The Accept header tells the server that we want food, rather than money or a less preferable thing like… hugs I guess?
Of course rather than burgers, webCoRE actually prefers JSON responses - but it will take anything you give it. Responsible servers will respect the Accept header and throw an error rather than trying to give you something you don’t expect. This affects GET requests and any other methods sending a request formatted as FORM data.
There are a few other fixes in the works for web requests, so if you need this fix quickly and want to apply a code patch, line 3301 in the webCoRE Piston smart app sets the
requestContentType and needs the following
contentType line added (this code is not specific to you, JSON is the only response that webCoRE understands and “prefers” but anything is acceptable)
requestContentType: requestContentType, contentType: 'application/json, */*;q=0.9', // add this line
Thanks to @leanbarton for reporting a piston that was having this issue