Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to enable the JSDO to use xmlhttprequest-cookie #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

edselg
Copy link

@edselg edselg commented Feb 16, 2017

When working with the xmlhttprequest-cookie library, objects created using the wrapper are not recognized as instances of XMLHttpRequest. (instanceof XMLHttpRequest).
Specified "XMLHttpRequest" as the function name so that code can check for constructor.name.

The new behavior is consistent with web browser behavior where constructor.name for an XHR object is set.

When working with FORM-based authentication from the JSDO.
The Accept header always includes "/" because it is listed in the defaultHeaders variable.
Code in the JSDOSession expects to be able to set the Accept header to "application/json".
Changed line 545 to copy defaultHeaders to the headers variable and then delete the "Accept" property so that it can be set by calling setRequestHeader(). If the Accept header is not specified, then code in line 337 ensures that it is set to the default: "/".

The new behavior is consistent with web browser behavior where the Accept header is not set by default.
See:
https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/setRequestHeader

When working with the xmlhttprequest-cookie library, objects created using the wrapper are not recognized as instances of XMLHttpRequest. (instanceof XMLHttpRequest).
Specified "XMLHttpRequest" as the function name so that code can check for constructor.name.

The new behavior is consistent with web browser behavior where constructor.name for an XHR object is set.

When working with FORM-based authentication from the JSDO.
The Accept header always includes "*/*" because it is listed in the defaultHeaders variable.
Code in the JSDOSession expects to be able to set the Accept header to "application/json".
Changed line 545 to copy defaultHeaders to the headers variable and then delete the "Accept" property so that it can be set by calling setRequestHeader(). If the Accept header is not specified, then code in line 337 ensures that it is set to the default: "*/*".

The new behavior is consistent with web browser behavior where the Accept header is not set by default.
See:
https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/setRequestHeader
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant