Skip to content

Compression App (with Node.js)#179

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

Compression App (with Node.js)#179
NadiiaBulmak wants to merge 2 commits intomate-academy:masterfrom
NadiiaBulmak:develop

Conversation

@NadiiaBulmak
Copy link

No description provided.

Copy link

@Anton-Kuchmasov Anton-Kuchmasov left a comment

Choose a reason for hiding this comment

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

Well done!

Please check comments below - they might be helpful in your future tasks


if (request.method !== 'POST') {
response.statusCode = 400;
response.setHeader('Content-Type', 'text/plain');

Choose a reason for hiding this comment

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

Better add this header to separate const and add it everywhere in your app

also, you can make a function-wrapper e.g. prepareResponse(statusCode) to add statusCode and headers more consistenly

Comment on lines 62 to 69
if (compressionType === 'gzip') {
compressStream = zlib.createGzip();
} else if (compressionType === 'deflate') {
compressStream = zlib.createDeflate();
} else if (compressionType === 'br') {
compressStream = zlib.createBrotliCompress();
} else {
response.statusCode = 400;

Choose a reason for hiding this comment

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

use switch-case here

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for review! Improvements are pushed! )

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