Documenting the login event.
This commit is contained in:
parent
7f8b180f70
commit
fdfa0f4a6d
1 changed files with 24 additions and 1 deletions
|
@ -95,6 +95,12 @@ Returns:
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
|
* `authInfo` Object
|
||||||
|
* `isProxy` Boolean
|
||||||
|
* `scheme` String
|
||||||
|
* `host` String
|
||||||
|
* `port` Integer
|
||||||
|
* `realm` String
|
||||||
* `callback` Function
|
* `callback` Function
|
||||||
|
|
||||||
Emitted when an authenticating proxy is asking for user credentials.
|
Emitted when an authenticating proxy is asking for user credentials.
|
||||||
|
@ -104,7 +110,24 @@ The `callback` function is expected to be called back with user credentials:
|
||||||
* `usrename` String
|
* `usrename` String
|
||||||
* `password` String
|
* `password` String
|
||||||
|
|
||||||
Providing empty credentials will cancel the request.
|
```JavaScript
|
||||||
|
request.on('login', (authInfo, callback) => {
|
||||||
|
callback('username', 'password')
|
||||||
|
})
|
||||||
|
```
|
||||||
|
Providing empty credentials will cancel the request and report an authentication error on the response object:
|
||||||
|
|
||||||
|
```JavaScript
|
||||||
|
request.on('response', (response) => {
|
||||||
|
console.log(`STATUS: ${response.statusCode}`);
|
||||||
|
response.on('error', (error) => {
|
||||||
|
console.log(`ERROR: ${JSON.stringify(error)}`)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
request.on('login', (authInfo, callback) => {
|
||||||
|
callback()
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
#### Event: 'finish'
|
#### Event: 'finish'
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue