Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Great job on implementing the server functionality! 🎉 The code meets the task requirements and correctly handles URL normalization and query parameters. While there's a minor suggestion to ensure req.headers.host is always defined to prevent potential issues, it doesn't impact the core functionality. Keep up the good work and consider adding error handling for robustness in the future! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
| /* Write your code here */ | ||
| // Return instance of http.Server class | ||
| const server = http.createServer((req, res) => { | ||
| const normalizedURL = new URL(req.url, `http://${req.headers.host}`); |
There was a problem hiding this comment.
The URL constructor is used here to normalize the request URL. Ensure that req.headers.host is always defined, as it might cause issues if the host header is missing or malformed. Consider adding error handling for such cases.
No description provided.