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

feat(streaming): add Identity as Content-Encoding for streamText() #3476

Closed
wants to merge 1 commit into from

Conversation

yusukebe
Copy link
Member

@yusukebe yusukebe commented Oct 1, 2024

Closes #3449

The author should do the following, if applicable

  • Add tests
  • Run tests
  • bun run format:fix && bun run lint:fix to format the code
  • Add TSDoc/JSDoc to document the code

Copy link

codecov bot commented Oct 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.58%. Comparing base (f1ec415) to head (9ff92eb).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3476   +/-   ##
=======================================
  Coverage   95.58%   95.58%           
=======================================
  Files         155      155           
  Lines        9357     9358    +1     
  Branches     2746     2843   +97     
=======================================
+ Hits         8944     8945    +1     
  Misses        413      413           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yusukebe
Copy link
Member Author

yusukebe commented Oct 1, 2024

Hey @sor4chi

Can you review this?

@@ -11,5 +11,6 @@ export const streamText = (
c.header('Content-Type', TEXT_PLAIN)
c.header('X-Content-Type-Options', 'nosniff')
c.header('Transfer-Encoding', 'chunked')
c.header('Content-Encoding', 'identity')
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this header setting isn’t overridable. Is it OK?

it('Content-Encoding should be able to override', async () => {
  c.header('Content-Encoding', 'gzip')

  const res = streamText(c, async (stream) => {
    await stream.write('test')
  })

  expect(res.headers.get('content-encoding')).toBe('gzip') // should be gzip, but got identity
})

@yusukebe
Copy link
Member Author

yusukebe commented Oct 4, 2024

See #3449 (comment). Closing.

@yusukebe yusukebe closed this Oct 4, 2024
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.

Content-Encoding header is gzip without compression middleware
2 participants