travis-ci / moustached-hubot

Moustached ChatOps for your hubot.
MIT License
42 stars 17 forks source link

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

Open eric opened 10 years ago

eric commented 10 years ago

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

roidrage commented 10 years ago

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

scootklein commented 10 years ago

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 commented 10 years ago

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

roidrage commented 10 years ago

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

scootklein commented 10 years ago

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