Move addition of headers.

"Sets the value of an HTTP request header.You must call setRequestHeader() after open(), but before send()."

Get from https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest