Allow access request headers both in Express.js and Web Api (Next.js) manner#317
Merged
Allow access request headers both in Express.js and Web Api (Next.js) manner#317
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR enables dual support for accessing request headers in both Express.js and Web API (Next.js) styles by introducing a new Headers implementation and updating the mockRequest object accordingly.
- Fixed a spelling mistake in test descriptions.
- Updated tests to verify header access via the new Headers interface.
- Integrated the new createHeaders function into mockRequest and provided comprehensive tests in headers.spec.js.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/lib/mockRequest.spec.ts | Spelling fix in test description and updated assertions for headers.get. |
| test/lib/headers.spec.js | Added tests for the new Headers implementation and its methods. |
| lib/mockRequest.js | Updated to use createHeaders for header initialization. |
| lib/headers.js | New file implementing a Headers proxy with both Express.js and Web API support. |
Comments suppressed due to low confidence (1)
test/lib/mockRequest.spec.ts:45
- Correct the typo in the test description: change 'shoud' to 'should'.
it('shoud initialize with default options', () => {
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #316