Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial abstract classes #32298

Closed
wants to merge 2 commits into from
Closed

Conversation

karaggeorge
Copy link
Contributor

Bug

  • Related issues linked using fixes #number
  • Integration tests added
  • Errors have helpful link attached, see contributing.md

Feature

  • Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
  • Related issues linked using fixes #number
  • Integration tests added
  • Documentation added
  • Telemetry added. In case of a feature if it's used or not.
  • Errors have helpful link attached, see contributing.md

Documentation / Examples

  • Make sure the linting passes by running yarn lint

@ijjk ijjk added the type: next label Dec 8, 2021
abstract getHeader(name: string): string | string[] | undefined

abstract getAllHeaders(): Record<string, string | string[]>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might also need to add abstract methods for getting a cookie/all cookies. I know that in the web side, we'll have to do some extra implementation for Set-Cookie headers, so we might also have to inject some cookies into the request, but not 100% sure if needed yet

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's already handled by

setLazyProp({ req: req as any }, 'cookies', getCookieParser(req.headers))
so might not needed in the base class right now.

this.sendResolve = resolve
})
private sendResolve?: () => void
private response = this.sendPromise.then(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will behave same as Node response. This promise will resolve when send is called with a Response object that has the headers/status at that moment, but the body will still be able to be streamed.

To match 100%, we could add a call to send within the transform stream when the first write happens, but since we'll only be using streams in render.tsx we can just call send there manually for simplicity

@shuding shuding mentioned this pull request Dec 9, 2021
15 tasks
@karaggeorge
Copy link
Contributor Author

Closing in favor of #32999

@karaggeorge karaggeorge closed this Jan 4, 2022
@vercel vercel locked as resolved and limited conversation to collaborators Feb 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants