Skip to content

Commit

Permalink
feat: Allow specifying the HTTP verb on the command line
Browse files Browse the repository at this point in the history
Use the -X command-line parameter, like curl.
  • Loading branch information
prantlf committed Nov 6, 2017
1 parent 2c53c6e commit 1f055d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ Options:
-I, --head use HEAD verb to show document info only
-u, --unit <unit> set time unit: ms, s+ns
-U, --user <credentials> credentials for Basic Authentication
-X, --request <verb> specify HTTP verb to use for the request
-h, --help output usage information
The default output format is "text" and time unit "ms".
Options -H, -I and -U are the same as -H, -I and -u for curl.
Options "HIXU" are the same as "HIXu" for curl.
Timings are printed to the standard output.
```

Expand Down
5 changes: 3 additions & 2 deletions bin/nettime
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ commander.version(pkg.version)
.option('-I, --head', 'use HEAD verb to show document info only')
.option('-u, --unit <unit>', 'set time unit: ms, s+ns')
.option('-U, --user <credentials>', 'credentials for Basic Authentication')
.option('-X, --request <verb>', 'specify HTTP verb to use for the request')

commander.on('--help', function () {
console.log()
console.log(' The default output format is "text" and time unit "ms".')
console.log(' Options -H, -I and -U are the same as -H, -I and -u for curl.')
console.log(' Options "HIXU" are the same as "HIXu" for curl.')
console.log(' Timings are printed to the standard output.')
console.log()
console.log(' Examples:')
Expand Down Expand Up @@ -70,7 +71,7 @@ if (credentials) {

nettime({
url: url,
method: commander.head ? 'HEAD' : 'GET',
method: commander.head ? 'HEAD' : commander.request || 'GET',
headers: headers,
credentials: credentials,
rejectUnauthorized: !commander.ignoreCertificate
Expand Down

0 comments on commit 1f055d1

Please sign in to comment.