Skip to content
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

Jake #1

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

Jake #1

wants to merge 16 commits into from

Conversation

Loaye
Copy link

@Loaye Loaye commented Jul 26, 2017

No description provided.

server.js Outdated

if(req.method === 'GET' && req.url.pathname === '/') {
let params = req.url.query;
res.write(cowsay.say(200, {text: 'Hello from my server!'}));
Copy link

Choose a reason for hiding this comment

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

cowsay doesn't want a status code.

server.js Outdated
res.write(cowsay.say({text: req.body.text}));
} else {
res.statusCode = 400;
res.write(400, cowsay.say({text: 'bad request'}));
Copy link

Choose a reason for hiding this comment

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

Also here this will cause an error.

server.js Outdated
res.end();
}

res.end();
Copy link

Choose a reason for hiding this comment

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

this in some cases will cause write after end error. It can be good to either handle them all at the end or to handle them all at each path not both.

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