set correct status codes, response is json and header is set