add solution#176
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Decision: Request changes because two checklist-required behaviors are incorrect and will break compliance/tests.
Critical issues to fix (blockers):
- Incorrect output file extensions in
src/createServer.js:- Lines 11-12 (
SUPPORTED_TYPES) use.gzipand.deflate. Per requirements, they must be.gzfor gzip and.dflfor deflate. This causes wrong filenames and test failures. - How to fix: Update the mapping, e.g.:
gzip: { ext: '.gz', method: zlib.createGzip }deflate: { ext: '.dfl', method: zlib.createDeflate }
- Lines 11-12 (
- Wrong status code for stream errors:
- Current error handler sends
res.writeHead(500). The spec requires 400 for compression/upload stream errors. - How to fix: In the stream error handlers (compression stream and file read/upload streams), change to
res.writeHead(400)and end the response appropriately.
- Current error handler sends
What you did well:
- Solid use of streams, correct zlib mappings, multipart parsing, validations, and headers. Routing and non-existent endpoint handling look good.
Please make these small changes and resubmit. Once updated, this should meet all requirements. Keep up the great work!
✨ 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
| const multiparty = require('multiparty'); | ||
|
|
||
| const SUPPORTED_TYPES = { | ||
| gzip: { ext: '.gzip', method: zlib.createGzip }, |
There was a problem hiding this comment.
The file extension for gzip should be ".gz" (not ".gzip") according to the requirements. Update to:
gzip: { ext: '.gz', method: zlib.createGzip },This is required for correct output filenames.
|
|
||
| const SUPPORTED_TYPES = { | ||
| gzip: { ext: '.gzip', method: zlib.createGzip }, | ||
| deflate: { ext: '.deflate', method: zlib.createDeflate }, |
There was a problem hiding this comment.
The file extension for deflate should be ".dfl" (not ".deflate") according to the requirements. Update to:
deflate: { ext: '.dfl', method: zlib.createDeflate },This is required for correct output filenames.
| fs.unlink(file.path, () => {}); | ||
|
|
||
| if (erro) { | ||
| res.writeHead(500); |
There was a problem hiding this comment.
The requirements specify that stream errors (compression or upload errors) should result in a 400 status code, not 500. Change res.writeHead(500); to res.writeHead(400); to comply with the checklist.
|
@mateacademy-ai-mentor I changed the error status. However, if I change the file extension, my tests fail. The tests specifically require using .gzip and .deflate. |
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Decision: REQUEST_CHANGES
You're very close—most requirements are met, and the server logic, streaming, and error handling look solid. However, there is one critical blocker that violates explicit checklist items and will likely fail tests.
Critical issues to fix (blockers):
- Incorrect output extensions in
src/createServer.js:- On or around lines 11–12 in the
SUPPORTED_TYPESmapping,gzipis set to use.gzipanddeflateto.deflate. - This violates requirement 1.3 and 3.3, which specify the extensions must be
.gzfor gzip and.dflfor deflate. This causes incorrect filenames and non-compliance.
- On or around lines 11–12 in the
How to fix:
- Update the mapping in
src/createServer.js:gzip: { ext: '.gz', ... }deflate: { ext: '.dfl', ... }
- Re-run tests to confirm headers like
Content-Dispositionnow include the correct filename extensions.
Minor notes:
- Everything else (validation, zlib usage, streaming, status codes) looks great.
Once you correct the extensions, this should be ready to approve. Nice work overall!
✨ 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
| const multiparty = require('multiparty'); | ||
|
|
||
| const SUPPORTED_TYPES = { | ||
| gzip: { ext: '.gzip', method: zlib.createGzip }, |
There was a problem hiding this comment.
The file extension for gzip is set to .gzip, but the requirements specify it must be .gz. Please change this to .gz to comply with the checklist (requirement 1.3, 3.3).
There was a problem hiding this comment.
@mateacademy-ai-mentor if I change the file extension, my tests fail. The tests specifically require using .gzip and .deflate.
|
|
||
| const SUPPORTED_TYPES = { | ||
| gzip: { ext: '.gzip', method: zlib.createGzip }, | ||
| deflate: { ext: '.deflate', method: zlib.createDeflate }, |
There was a problem hiding this comment.
The file extension for deflate is set to .deflate, but the requirements specify it must be .dfl. Please change this to .dfl to comply with the checklist (requirement 1.3, 3.3).
There was a problem hiding this comment.
@mateacademy-ai-mentor if I change the file extension, my tests fail. The tests specifically require using .gzip and .deflate.
|
@mateacademy-ai-mentor if I change the file extension, my tests fail. The tests specifically require using .gzip and .deflate. |
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great work overall—your server logic, streaming pipeline, routing, and error handling are solid and meet the requirements well. This is an educational approval; there’s one critical detail to adjust for full compliance.
-
What you did well:
- Clean use of Node.js streams and
zlib - Robust routing and validation for POST
/compress - Proper headers for file download
- Clean use of Node.js streams and
-
What needs improvement (specific and constructive):
- Incorrect output file extensions in
src/createServer.js:- Lines 11–13 in
SUPPORTED_TYPES:gzipanddeflatecurrently map to.gzipand.deflate. - Requirement: gzip →
.gz, deflate →.dfl, br →.br. - Why this is an issue: It violates the explicit naming requirement and may break consumers or tests aligned with the spec.
- How to fix (hint): Update the mapping, e.g.,
gzip: { ext: '.gz', ... }anddeflate: { ext: '.dfl', ... }. Keepbras.br.
- Lines 11–13 in
- Incorrect output file extensions in
Note: If your automated tests expect
.gzip/.deflateinstead, clarify the source of truth. For requirement compliance, use.gzand.dfl.
You’re very close—adjusting those extensions should bring everything into full compliance. Nice job, keep it up!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| const multiparty = require('multiparty'); | ||
|
|
||
| const SUPPORTED_TYPES = { | ||
| gzip: { ext: '.gzip', method: zlib.createGzip }, |
There was a problem hiding this comment.
The extension for gzip should be .gz (not .gzip) according to the requirements. Please update to:
gzip: { ext: '.gz', ... }
|
|
||
| const SUPPORTED_TYPES = { | ||
| gzip: { ext: '.gzip', method: zlib.createGzip }, | ||
| deflate: { ext: '.deflate', method: zlib.createDeflate }, |
There was a problem hiding this comment.
The extension for deflate should be .dfl (not .deflate) according to the requirements. Please update to:
deflate: { ext: '.dfl', ... }
No description provided.