lukeautry / tsoa

Build OpenAPI-compliant REST APIs using TypeScript and Node
MIT License
3.46k stars 497 forks source link

Hapi authentication callback should include ResponseToolkit (h) object #1239

Open wallacethefmh opened 2 years ago

wallacethefmh commented 2 years ago

Sorting

Expected Behavior

hapiAuthentication callback should also receive the hapi.ResponseToolkit (aka h) object.

Current Behavior

hapiAuthentication only gets the Request object

Possible Solution

export async function hapiAuthentication(
  request: Request,
  h: ResponseToolkit,
  securityName: string,
  _scopes?: string[],
)

Steps to Reproduce

N/A

Context (Environment)

N/A

Detailed Description

The hapiAuthentication callback should also receive the hapi.ResponseToolkit (aka h). It currently only has access to the hapi.Request object. h is useful for example when trying to avoid the terrible Boom library, with the ability to use Response.takeover(). There are probably other use cases as well

Breaking change?

Yes if implemented as I described above.

github-actions[bot] commented 2 years ago

Hello there wallacethefmh 👋

Thank you for opening your very first issue in this project.

We will try to get back to you as soon as we can.👀

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

WoH commented 2 years ago

I'd be open to injecting this on demand

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

fage88 commented 8 months ago

I would be interested in something similar to this for koa responses.