Feedback: listen() #390
Answered
by
kettanaito
Pho3nixHun
asked this question in
Q&A
-
FeedbackThe documentation treats the url property as a URL, server.listen({
onUnhandledRequest(request, print) {
// Ignore requests to fetch static assets.
if (request.url.pathname.includes('/assets/')) {
return
}
// Otherwise, print a warning for any unhandled request.
print.warning()
},
}) while in reality it is just a string. You have to manually convert it to an url: const url = new URL(request.url)
if (url.pathname.includes('/assets/')) {
...
} |
Beta Was this translation helpful? Give feedback.
Answered by
kettanaito
Apr 25, 2024
Replies: 2 comments
-
Hi, @Pho3nixHun. That's a great find! It's a leftover from the v1 docs where |
Beta Was this translation helpful? Give feedback.
0 replies
-
I've merged the fix, it should be live now. Once again, thanks for spotting this! If you find any other discrepancies in the docs, please let me know. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
kettanaito
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've merged the fix, it should be live now. Once again, thanks for spotting this! If you find any other discrepancies in the docs, please let me know.