@@ -21,7 +21,7 @@ import { notFoundHandler } from './notFoundHandler';
|
||||
describe('notFoundHandler', () => {
|
||||
it('handles only missing routes', async () => {
|
||||
const app = express();
|
||||
app.use('/exists', (_, res) => res.status(200).send());
|
||||
app.use('/exists', (_, res) => res.status(200).end());
|
||||
app.use(notFoundHandler());
|
||||
|
||||
const existsResponse = await request(app).get('/exists');
|
||||
|
||||
@@ -28,6 +28,6 @@ import { NextFunction, Request, RequestHandler, Response } from 'express';
|
||||
export function notFoundHandler(): RequestHandler {
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
return (_request: Request, response: Response, _next: NextFunction) => {
|
||||
response.status(404).send();
|
||||
response.status(404).end();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ describe('requestLoggingHandler', () => {
|
||||
|
||||
const app = express();
|
||||
app.use(requestLoggingHandler(logger));
|
||||
app.use('/exists1', (_, res) => res.status(200).send());
|
||||
app.use('/exists2', (_, res) => res.status(201).send());
|
||||
app.use('/exists1', (_, res) => res.status(200).end());
|
||||
app.use('/exists2', (_, res) => res.status(201).end());
|
||||
|
||||
const r = request(app);
|
||||
await r.get('/exists1');
|
||||
|
||||
@@ -55,7 +55,7 @@ export async function statusCheckHandler(
|
||||
return async (_request: Request, response: Response, next: NextFunction) => {
|
||||
try {
|
||||
const status = await statusCheck();
|
||||
response.status(200).header('').send(status);
|
||||
response.status(200).json(status);
|
||||
} catch (err) {
|
||||
next(err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user