Skip to content

Commit

Permalink
Address TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
watson committed Dec 15, 2020
1 parent b1ed8e7 commit ff8489f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/core/server/http/http_server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,7 @@ describe('timeout options', () => {
router.get(
{
path: '/',
validate: false, // TODO: Figure out if we can/should use `{ body: schema.any() }` instead
validate: { body: schema.maybe(schema.any()) },
},
(context, req, res) => {
return res.ok({
Expand Down Expand Up @@ -1199,7 +1199,7 @@ describe('timeout options', () => {
router.get(
{
path: '/',
validate: false, // TODO: Figure out if we can/should use `{ body: schema.any() }` instead
validate: { body: schema.maybe(schema.any()) },
options: { timeout: { idleSocket: 12000 } },
},
(context, req, res) => {
Expand Down
4 changes: 2 additions & 2 deletions src/core/server/http/http_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,11 @@ export class HttpServer {
output,
parse,
timeout: timeout?.payload,
multipart: true, // TODO: Figure out what the default value should be
multipart: true,
}
: undefined,
timeout: {
socket: timeout?.idleSocket ?? this.config!.socketTimeout ?? false, // TODO: Do we really want to fall back to NO timeout? Shouldn't we default to the default Node.js timeout of 2 minutes?
socket: timeout?.idleSocket ?? this.config!.socketTimeout,
},
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/http/router/response_adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export class HapiResponseAdapter {

const attributes = getErrorAttributes(payload);
if (attributes) {
// @ts-expect-error `attributes` does not exist on the `Payload` type, however it does exist in real life (https://github.com/hapijs/boom/issues/277)
// @ts-expect-error Custom properties on `output.payload` aren't allowed by TS, however, it's the only way to send custom data to the client (https://github.com/hapijs/boom/issues/277).
error.output.payload.attributes = attributes;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ async function fetchByObjects({
const erroredObjects = bulkGetResult.saved_objects.filter((obj) => !!obj.error);
if (erroredObjects.length) {
const err = Boom.badRequest();
// @ts-expect-error `attributes` does not exist on the `Payload` type, however it does exist in real life (https://github.com/hapijs/boom/issues/277)
// @ts-expect-error Custom properties on `output.payload` aren't allowed by TS, however, it's the only way to send custom data to the client (https://github.com/hapijs/boom/issues/277).
err.output.payload.attributes = {
objects: erroredObjects,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export async function getNonExistingReferenceAsKeys(
);
if (erroredObjects.length) {
const err = Boom.badRequest();
// @ts-expect-error `attributes` does not exist on the `Payload` type, however it does exist in real life (https://github.com/hapijs/boom/issues/277)
// @ts-expect-error Custom properties on `output.payload` aren't allowed by TS, however, it's the only way to send custom data to the client (https://github.com/hapijs/boom/issues/277).
err.output.payload.attributes = {
objects: erroredObjects,
};
Expand Down

0 comments on commit ff8489f

Please sign in to comment.