-
Notifications
You must be signed in to change notification settings - Fork 89
fix: Return MiddlewareResponse obj for rewrite #2159
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
7bb63d8
fix: Return MiddlewareResponse for rewrite
taty2010 f46ab43
chore: remove console logs
taty2010 52b12a9
chore: added tests and updated logic to include init
taty2010 1ec8d01
Merge branch 'main' into tn-advMiddlewareRewrite
taty2010 4816efc
Merge branch 'main' into tn-advMiddlewareRewrite
taty2010 243330d
chore: revert selector back to original
taty2010 4199c23
fix: pass in new headers
taty2010 0689fca
chore: applyheader before response
taty2010 f181b44
chore: update tests remove header fix
taty2010 993cba6
chore: testing update
taty2010 3d3ac2a
Merge branch 'main' into tn-advMiddlewareRewrite
taty2010 23caa96
Merge branch 'main' into tn-advMiddlewareRewrite
taty2010 40ade6d
chore: removed undici import
taty2010 3a38588
chore: added undici import back
taty2010 f04c6b6
Merge branch 'main' into tn-advMiddlewareRewrite
taty2010 3353d66
Update demos/middleware/middleware.ts
taty2010 983c8fe
Update cypress/e2e/middleware/enhanced.cy.ts
taty2010 29e5502
chore: removed header override testing
taty2010 6a1e00d
chore: formatting
taty2010 f1c210d
chore: new line
taty2010 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const Rewrite = () => { | ||
return ( | ||
<div> | ||
<p>This should have been rewritten</p> | ||
</div> | ||
) | ||
} | ||
|
||
export default Rewrite | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import * as React from 'react' | ||
|
||
const useHydrated = () => { | ||
const [hydrated, setHydrated] = React.useState(false) | ||
React.useEffect(() => { | ||
setHydrated(true) | ||
}, []) | ||
return hydrated | ||
} | ||
|
||
const Page = ({ message, showAd }) => { | ||
const hydrated = useHydrated() | ||
return ( | ||
<div> | ||
<p id="message">{message}</p> | ||
{hydrated && showAd ? ( | ||
<div> | ||
<p>This is an ad that isn't shown by default on static test 2 page</p> | ||
<img src="http://placekitten.com/400/300" /> | ||
</div> | ||
) : ( | ||
<p>No ads for me</p> | ||
)} | ||
</div> | ||
) | ||
} | ||
|
||
export async function getStaticProps() { | ||
return { | ||
props: { | ||
message: 'This is a static page', | ||
showAd: false, | ||
}, | ||
} | ||
} | ||
|
||
export default Page |
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we never figured out why the
undici
dep was no longer included?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It happened here c295bc2
it got removed from package-lock but it looks like it was not set as a dep in the package.json.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we move to Node.js 18,
fetch
is native, so this import won't be required.