JavaScript: set Accept: and Content-Type: headers in request