Skip to content

Commit

Permalink
fix(url): Pass parsed url to got (#28)
Browse files Browse the repository at this point in the history
This allows for usage of things such as basic auth, and other features
that node's built-in url library support that `got` expects.

I only tested this by installing node-geckodriver via

```
GECKODRIVER_CDNURL="https://${ght}@github.com/mozilla/geckodriver/releases/download" npm link ../node-geckodriver/
```

and confirmed that it no longer threw the error present in the upstream
issue sindresorhus/got#184

```
Error: Basic authentication must be done with auth option                                                                                                      │$: git co master
    at normalizeArguments (~/code/project/node_modules/got/index.js:215:10)
```
  • Loading branch information
Droogans authored and vladikoff committed Nov 2, 2017
1 parent c09239f commit bd5689b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
@@ -1,6 +1,7 @@
var os = require('os');
var fs = require('fs');
var path = require('path');
var url = require('url');

var got = require('got');
var targz = require('tar.gz');
Expand Down Expand Up @@ -39,7 +40,7 @@ if (platform === 'win32') {
}

process.stdout.write('Downloading geckodriver... ');
got.stream(downloadUrl)
got.stream(url.parse(downloadUrl))
.pipe(fs.createWriteStream(outFile))
.on('close', function() {
process.stdout.write('Extracting... ');
Expand Down

0 comments on commit bd5689b

Please sign in to comment.