Skip to content
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