Skip to content

Commit

Permalink
add test on undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
mshustov committed Oct 19, 2020
1 parent 7a8d52d commit 07032b6
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/core/server/http/integration_tests/lifecycle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,23 @@ describe('OnPreRouting', () => {
.expect(200, { rewrittenUrl: '/initial?name=foo' });
});

it('does not provide request url if interceptor does not rewrite url', async () => {
const { registerOnPreRouting, server: innerServer, createRouter } = await server.setup(
setupDeps
);
const router = createRouter('/');

router.get({ path: '/login', validate: false }, (context, req, res) => {
return res.ok({ body: { rewrittenUrl: req.rewrittenUrl?.path } });
});

registerOnPreRouting((req, res, t) => t.next());

await server.start();

await supertest(innerServer.listener).get('/login').expect(200, {});
});

it('supports redirection from the interceptor', async () => {
const { registerOnPreRouting, server: innerServer, createRouter } = await server.setup(
setupDeps
Expand Down

0 comments on commit 07032b6

Please sign in to comment.