emberx-xml-http-request
emberx-xml-http-request copied to clipboard
Recommended way to set the headers?
How can i set headers
on the x-xhr-http-request
component?
I tried to pass headers
with a (hash)
helper.
Specifically, I passed in this:
{{x-xhr-http-request ... headers=(hash Accept="file/download; version=1.0.0") ...}}
but I got this error:
Uncaught InvalidStateError: Failed to execute 'setRequestHeader' on 'XMLHttpRequest': The object's state must be OPENED.
I debugged and breakpointed all the way to the fail point in XRequest
XRequest.prototype.setRequestHeader = function setRequestHeader(name, value) {
return this.state.xhr.setRequestHeader(name, value);
};
and confirmed that it was receiving the name
"Accept" and the value
"file/download; version=1.0.0"
https://github.com/cowboyd/x-request.js/blob/master/src/x-request.js#L55-L57
The error originated from XRequest, so I posted the issue there, just not sure where to go from here?