forwardemail / forwardemail/supertest
Express 4 routes with middleware gets 404
- Dominant language
- JavaScript
- Stars
- 14.4k
- Forks
- 782
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I have a problem with Express 4 protected routes, here is my route definition and test:
**Test:**
```
describe("POST /users/change-password", function() {
it("it should has status code 200", function(done) {
supertest(app)
.post("/users/change-password")
.set({ Authorization: 'bearer ' + token})
.send({
"password": "test1234",
"email": "testing+mocha@gmail.com"
})
.then((response) => {
expect(response.statusCode).toBe(200);
expect(response.type).toBe('application/json');
});
});
});
```
**Failing** route (404 error)
`router.post('/change-password', isLogged, UserController.changePassword);`
**Working** route
`router.post('/change-password', UserController.changePassword);`
Any idea how to solve this?
Thanks!
Contributor guide
Assessment
This issue has not been assessed yet.