-
Notifications
You must be signed in to change notification settings - Fork 998
Solution #1008
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
base: master
Are you sure you want to change the base?
Solution #1008
Conversation
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.
Review Summary
This is a strong submission and the core logic is implemented correctly. However, a couple of changes are needed to fully align with the project's specific requirements.
First, the server must always respond with JSON. The current implementation sends a plain text 'Not Found' for non-GET requests, which contradicts the Content-Type header. Please ensure this response is also a JSON object, for example: JSON.stringify({ message: 'Not Found' }).
Second, the status message for validation errors needs a minor capitalization adjustment. The requirements specify 'Bad request', but the code currently uses 'Bad Request'. Please update this to match the specification exactly.
Once these two details are addressed, your solution will be fully compliant. Great work so far!
✨ 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
src/createServer.js
Outdated
|
|
||
| if (req.method !== 'GET') { | ||
| res.statusCode = 404; | ||
| res.end('Not Found'); |
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.
The requirements state that the server should always respond with JSON. This response for non-GET requests sends a plain text body ('Not Found'), which contradicts the Content-Type: application/json header set on line 7. Consider sending a JSON object here as well, for example: JSON.stringify({ message: 'Not Found' }).
src/createServer.js
Outdated
|
|
||
| if (errors.length > 0) { | ||
| res.statusCode = 400; | ||
| res.statusMessage = 'Bad Request'; |
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.
The task requirements specify the status text should be exactly 'Bad request'. The current implementation uses 'Bad Request'. Please adjust the capitalization to match the requirements.
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.
Review Summary
Excellent work! You've successfully addressed all the points from the previous review. The server now correctly handles all responses with the application/json content type, and the status message for bad requests is exactly as specified. Your solution now fully meets all the requirements of the task, so I am approving it. Great job!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.