solution#1152
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am requesting changes because there is a requirements mismatch that will cause tests to fail. Specifically, for validation errors your 400 responses currently set res.statusMessage = 'Bad Request', but the specification requires the status text to be exactly "Bad request" (lowercase r), and tests are checking this string. To fix this, update the 400 error handling branch in src/createServer.js (where you set statusCode = 400) so that res.statusMessage is set to "Bad request" instead of "Bad Request". This is a critical, blocking issue because even though your validation logic, JSON structure, and success responses are all correct, the incorrect status text will cause the required test suite to fail. Everything else in your implementation—URL parsing, use of URLSearchParams, validation of text and toCase, and calling convertToCase with the right parameters—looks solid and aligned with the task. Once you adjust that status message string, your solution should fully meet the spec and behave correctly for the tests.
✨ 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
|
|
||
| if (errors.length > 0) { | ||
| res.statusCode = 400; | ||
| res.statusMessage = 'Bad Request'; |
There was a problem hiding this comment.
For validation errors the requirements specify the status text must be exactly "Bad request" (lowercase r), but here you set 'Bad Request'. Update this string to match the spec so tests relying on the exact status text will pass.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution is approved because it meets all the core functional and technical requirements for the server implementation. The createServer function is correctly exported, uses http.createServer, and focuses solely on the text case conversion endpoint. You parse the URL and query string properly, validate both the path text and the toCase parameter, and handle unsupported case values with the exact required error messages and a 400 Bad request status. On valid input, you call convertToCase with the correct arguments and return a 200 OK JSON response that includes originalCase, targetCase, originalText, and convertedText in the expected shape. The always-JSON responses with the correct Content-Type header and the additional 500 error handling branch are sensible and do not conflict with any requirements. Overall, the behavior aligns with the task description and should allow all tests to pass as written. Nice work implementing the server cleanly and adhering closely to the specification.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.