-
-
Notifications
You must be signed in to change notification settings - Fork 329
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
Target localhost by default if $PORT is set, closes #146. #147
Conversation
If the `$PORT` env variable is set, the URL defaults to `localhost:PORT/path`. You can pass a bare path for the URL. This allows doing: 0x --on-port 'autocannon /path' -- node server.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -5,6 +5,7 @@ | |||
const minimist = require('minimist') | |||
const fs = require('fs') | |||
const path = require('path') | |||
const URL = require('url').URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you throw an error if URL
is not available?
Was trying to use `argv.url` when it may not exist.
Can you please update the docs as well? CI is still failing :(. |
CI failures seem like the same as in #145 (comment). It passed on Node 6 and 10 this time and failed on 8, looks like flakiness. I think it would be easiest to fix it in #144 to prevent merge conflicts. |
🎉 ! |
If the
$PORT
env variable is set, the URL defaults tolocalhost:PORT/path
. You can pass a bare path for the URL.This allows doing:
When an invalid URL is given, autocannon now logs an error and exits.
(
/path
without a$PORT
is an invalid URL.)It uses the URL API which was backported to Node 6.13.0, if lower
versions of Node 6 should be supported I can change it to use
url.parse
andurl.format
instead.