moustached-hubot icon indicating copy to clipboard operation
moustached-hubot copied to clipboard

Posting to statuspage.io now requires a Content-Type header

Open eric opened this issue 12 years ago • 5 comments
trafficstars

When trying to post a new status update today I received the error:

Error updating incident "_________": Content-Type header must be set for a POST request with a body.

CC: @statuspage, @scootklein

eric avatar Oct 05 '13 02:10 eric

@scootklein @statuspage can you guys confirm that this is now a requirement?

roidrage avatar Oct 05 '13 07:10 roidrage

apologies, just removed this constraint. i falsely assumed this header was always present as a function of the HTTP client sending it with all POST requests. I had debugged a couple issues with other customers where params weren't coming through to the Rails side of things, and adding the Content-Type header seemed to fix it.

can you confirm for me things are working again on your end? this constraint will be left off until i can further pin down exactly what the behavior is.

scootklein avatar Oct 05 '13 14:10 scootklein

did some more digging on this. Rails will parse JSON encoded bodies into params even in the absence of a Content-Type header, but with form-encoded bodies it ignores the body outright if there is a blank Content-Type header.

sorry again for the trouble

scootklein avatar Oct 05 '13 16:10 scootklein

I can certainly apply a patch to the hubot scripts to fix this though.

roidrage avatar Oct 05 '13 17:10 roidrage

it couldn't hurt, but shouldn't be required. patching will just be certain to future-proof it

scootklein avatar Oct 05 '13 22:10 scootklein