Fix PUT and POST to handle either JSON or header string