Skip to content

Commit 59a3234

Browse files
Removed some tests as per request from code review that were exercising internals of Hapi server
1 parent 1817203 commit 59a3234

File tree

1 file changed

+0
-93
lines changed

1 file changed

+0
-93
lines changed

src/core/server/http/http_server.test.ts

Lines changed: 0 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,99 +1117,6 @@ describe('timeout options', () => {
11171117
timeout: 300000,
11181118
});
11191119
});
1120-
1121-
test('should reject a socket "timeout" of "0" for a POST', async () => {
1122-
const { registerRouter } = await server.setup(config);
1123-
1124-
const router = new Router('', logger, enhanceWithContext);
1125-
router.post(
1126-
{
1127-
path: '/',
1128-
validate: false,
1129-
options: { timeout: 0 },
1130-
},
1131-
(context, req, res) => {
1132-
try {
1133-
return res.ok({ body: { timeout: req.route.options.timeout } });
1134-
} catch (err) {
1135-
return res.internalError({ body: err.message });
1136-
}
1137-
}
1138-
);
1139-
registerRouter(router);
1140-
await expect(server.start()).rejects.toThrowError('Invalid routeConfig options');
1141-
});
1142-
1143-
test('should reject a socket "timeout" of "0" for a GET', async () => {
1144-
const { registerRouter } = await server.setup(config);
1145-
1146-
const router = new Router('', logger, enhanceWithContext);
1147-
router.get(
1148-
{
1149-
path: '/',
1150-
validate: false,
1151-
options: { timeout: 0 },
1152-
},
1153-
(context, req, res) => {
1154-
try {
1155-
return res.ok({ body: { timeout: req.route.options.timeout } });
1156-
} catch (err) {
1157-
return res.internalError({ body: err.message });
1158-
}
1159-
}
1160-
);
1161-
registerRouter(router);
1162-
// NOTE: This error message actually indicates a bug from within Hapi Server as you cannot configure the payload timeout when you
1163-
// are using a GET or HEAD route. Because of this Hapi server bug you cannot technically set a timeout less than 10 seconds when
1164-
// configuring a GET route including 0
1165-
await expect(server.start()).rejects.toThrowError(
1166-
'Payload timeout must be shorter than socket timeout: get /'
1167-
);
1168-
});
1169-
1170-
test('should reject a socket "timeout" of "0" for a PUT', async () => {
1171-
const { registerRouter } = await server.setup(config);
1172-
1173-
const router = new Router('', logger, enhanceWithContext);
1174-
router.put(
1175-
{
1176-
path: '/',
1177-
validate: false,
1178-
options: { timeout: 0 },
1179-
},
1180-
(context, req, res) => {
1181-
try {
1182-
return res.ok({ body: { timeout: req.route.options.timeout } });
1183-
} catch (err) {
1184-
return res.internalError({ body: err.message });
1185-
}
1186-
}
1187-
);
1188-
registerRouter(router);
1189-
await expect(server.start()).rejects.toThrowError('Invalid routeConfig options');
1190-
});
1191-
1192-
test('should reject a socket "timeout" of "0" for a PATCH', async () => {
1193-
const { registerRouter } = await server.setup(config);
1194-
1195-
const router = new Router('', logger, enhanceWithContext);
1196-
router.patch(
1197-
{
1198-
path: '/',
1199-
validate: false,
1200-
options: { timeout: 0 },
1201-
},
1202-
(context, req, res) => {
1203-
try {
1204-
return res.ok({ body: { timeout: req.route.options.timeout } });
1205-
} catch (err) {
1206-
return res.internalError({ body: err.message });
1207-
}
1208-
}
1209-
);
1210-
registerRouter(router);
1211-
await expect(server.start()).rejects.toThrowError('Invalid routeConfig options');
1212-
});
12131120
});
12141121

12151122
test('should return a stream in the body', async () => {

0 commit comments

Comments
 (0)