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

Update request.js #296

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ module.exports.agent = TestAgent;
*/

function Test (app, method, path) {
method = method.toUpperCase(); // Do this in order to avoid "patch" being sent as lowercase.
// This makes the preflight request -when running in browser- to be sent as "Access-Control-Request-Method = patch" instead of "Access-Control-Request-Method = PATCH"
// Which causes problems with those kind of requests. For further reference: https://stackoverflow.com/questions/55250297/problem-with-patch-method-and-cors-preflight-request?rq=1
Request.call(this, method, path);
this.app = app;
this.url = typeof app === 'string' ? app + path : serverAddress(app, path);
Expand Down