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

refactor!: new implementation #77

Merged
merged 5 commits into from
Jul 9, 2024
Merged

refactor!: new implementation #77

merged 5 commits into from
Jul 9, 2024

Conversation

climba03003
Copy link
Member

Fixes #15

There is problem I faced in handling 304, Node.js will filled with un-wanted headers.
So, the test need to remove some assertion on the removal of headers.

Checklist

Copy link
Member

@gurgunday gurgunday left a comment

Choose a reason for hiding this comment

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

Thanks for this!

It lgtm overall

@climba03003 climba03003 requested review from mcollina and a team July 8, 2024 09:26
@climba03003
Copy link
Member Author

climba03003 commented Jul 8, 2024

I am thinking do we need to provide similar utilities like the current .pipe.
It would be as simple as the below code for 304 case.

function pipe(send, res) {
  switch(send.statusCode) {
    case 304: {
      // remove Content-* headers
      res.removeHeader('Content-Encoding')
      res.removeHeader('Content-Language')
      res.removeHeader('Content-Length')
      res.removeHeader('Content-Range')
      res.removeHeader('Content-Type')
      break
    }
  }
  res.writeHead(send.statusCode, send.headers)
  send.stream.pipe(res)
}

lib/send.js Show resolved Hide resolved
@gurgunday gurgunday requested a review from a team July 8, 2024 10:53
@Uzlopak
Copy link
Contributor

Uzlopak commented Jul 8, 2024

We can now remove http-errors as dependency :)

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

README.md Show resolved Hide resolved
Copy link
Contributor

@Uzlopak Uzlopak left a comment

Choose a reason for hiding this comment

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

Remove http-errors as dependency ;)

@climba03003 climba03003 requested a review from Uzlopak July 8, 2024 16:24
Copy link
Contributor

@Uzlopak Uzlopak left a comment

Choose a reason for hiding this comment

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

LGTM

@mcollina mcollina merged commit 5019e3e into master Jul 9, 2024
16 checks passed
@Uzlopak Uzlopak deleted the next-refactor branch July 9, 2024 10:19
@gurgunday
Copy link
Member

@climba03003 do you have time to refactor @fastify/static?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor to remove the need for a PassThrough stream
4 participants