Skip to content

add task solution#371

Open
maksym-korchynskyi wants to merge 1 commit intomate-academy:masterfrom
maksym-korchynskyi:develop
Open

add task solution#371
maksym-korchynskyi wants to merge 1 commit intomate-academy:masterfrom
maksym-korchynskyi:develop

Conversation

@maksym-korchynskyi
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

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}`);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

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.

2 participants