Arne
11/11/2022, 6:07 AMrp_st
11/11/2022, 6:14 AMArne
11/11/2022, 6:15 AMArne
11/25/2022, 8:03 AMtest("get local tests working", async () => {
const response = await supertest(getApp(SubDomain.mgmt)).get("/api");
expect(response.status).toEqual(200);
});
While the response is still 200, the console print the following error message:
Error: Error: Response for preflight has invalid HTTP status code 401
at Object.dispatchError (/Users/arnewolframm/retality/node_modules/jsdom/lib/jsdom/living/xhr/xhr-utils.js:63:19)
at EventEmitter.<anonymous> (/Users/arnewolframm/retality/node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js:655:18)
at EventEmitter.emit (node:events:525:35)
at EventEmitter.emit (node:domain:489:12)
...etc...
What might I be doing wrong in the setup?rp_st
11/25/2022, 8:04 AMrp_st
11/25/2022, 8:04 AMArne
11/25/2022, 8:19 AMawait supertest(getApp(SubDomain.mgmt))
.get("/auth/signup/email/exists")
.query("email=arne.wolframm@gmail.com");
I don't think any additional headers are needed?rp_st
11/25/2022, 8:20 AMArne
11/25/2022, 8:25 AMcurl --location --request GET 'http://localhost:3331/auth/signup/email/exists?email=arne.wolframm@gmail.com'
I get {
"exists": true,
"status": "OK"
}
When I use the above supertest, I get 401Arne
11/25/2022, 8:29 AMconst response = await supertest.agent("http://localhost:3331")
.get("/auth/signup/email/exists")
.query("email=arne.wolframm@gmail.com");
I seem to get the error when I let supertest actually start the server by passing the Express app to it.Arne
11/25/2022, 8:31 AMrp_st
11/25/2022, 8:36 AMArne
11/25/2022, 8:36 AMAdiboi
11/25/2022, 2:54 PM