set content-type to application/json, improved logging