Skip to content

solution#418

Open
Anton-Kuchmasov wants to merge 2 commits intomate-academy:masterfrom
Anton-Kuchmasov:develop
Open

solution#418
Anton-Kuchmasov wants to merge 2 commits intomate-academy:masterfrom
Anton-Kuchmasov:develop

Conversation

@Anton-Kuchmasov
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.

Review Summary

REQUEST_CHANGES

Thank you for your submission! Your server implementation is clear and handles most requirements well, especially with parsing query parameters and structuring the JSON response. However, there is a critical blocker that needs to be addressed before approval:

  • Path Segments Handling: The parts array in your JSON response may include empty strings when the path has leading, trailing, or consecutive slashes. According to the requirements, empty segments must be ignored. For example, /hello//world/ should result in parts: ['hello', 'world'], and / or //// should result in parts: [].

What to fix:

  • After splitting the pathname by /, filter out empty strings:
    pathname.split('/').filter(Boolean)
    This will ensure only non-empty path segments are included in the parts array, matching the specification.

Once you make this adjustment, your code should fully meet the requirements. Great job on the rest of the implementation—you're very close! Let me know if you have any questions about this change.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

const normalizedUrl = new URL(preparedUrl, BASE_URL);

const pathname = normalizedUrl.pathname.slice(1);
const pathnameArray = pathname.split('/');
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 code splits the pathname using pathname.split('/'), but does not filter out empty strings. According to the requirements, empty strings resulting from leading, trailing, or consecutive slashes must be ignored. You should filter the array to remove empty strings, e.g., pathname.split('/').filter(Boolean).

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.

Review Summary

All core requirements are fully met. Your HTTP server implementation correctly parses the URL path into non-empty segments (ignoring doubled or more slashes), extracts query parameters into an object, and responds with the expected JSON format. Edge cases such as empty paths and missing query parameters are handled robustly. The code is clean, concise, and directly addresses the task's needs. Great job! You can proceed to the next step.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

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