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

Properly handle requests with malformed URIs #442

Merged
merged 2 commits into from
Jul 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions bin/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ const pkg = require('../package');
const readFile = promisify(fs.readFile);
const lookup = promisify(dns.lookup);

const warning = message => chalk`{yellow WARNING:} ${message}`;
const info = message => chalk`{magenta INFO:} ${message}`;
const error = message => chalk`{red ERROR:} ${message}`;
const warning = (message) => chalk`{yellow WARNING:} ${message}`;
const info = (message) => chalk`{magenta INFO:} ${message}`;
const error = (message) => chalk`{red ERROR:} ${message}`;

const updateCheck = async isDebugging => {
const updateCheck = async (isDebugging) => {
let update = null;

try {
Expand Down Expand Up @@ -103,7 +103,7 @@ const getHelp = () => chalk`
{bold $} {cyan serve} -l pipe:\\\\.\\pipe\\{underline PipeName}
`;

const parseEndpoint = str => {
const parseEndpoint = (str) => {
if (!isNaN(str)) {
return [str];
}
Expand Down Expand Up @@ -137,7 +137,7 @@ const parseEndpoint = str => {
}
};

const registerShutdown = fn => {
const registerShutdown = (fn) => {
let run = false;

const wrapper = () => {
Expand All @@ -157,7 +157,7 @@ const startEndpoint = (endpoint, config, args) => {
const {isTTY} = process.stdout;
const clipboard = args['--no-clipboard'] !== true;

server.on('error', err => {
server.on('error', (err) => {
console.error(error(`Failed to serve: ${err.stack}`));
process.exit(1);
});
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"author": "leo",
"license": "MIT",
"devDependencies": {
"@zeit/eslint-config-node": "0.2.13",
"@zeit/eslint-config-node": "0.3.0",
"@zeit/git-hooks": "0.1.4",
"eslint": "4.19.1"
"eslint": "5.0.1"
},
"eslintConfig": {
"extends": [
Expand All @@ -36,13 +36,13 @@
"pre-commit": "lint-staged"
},
"dependencies": {
"@zeit/schemas": "1.2.0",
"ajv": "6.5.1",
"@zeit/schemas": "1.5.1",
"ajv": "6.5.2",
"arg": "2.0.0",
"boxen": "1.3.0",
"chalk": "2.4.1",
"clipboardy": "1.2.3",
"serve-handler": "3.2.1",
"serve-handler": "3.2.3",
"update-check": "1.5.2"
}
}
Loading