(@hapi/nes) fix: add reauthenticate method (#37072)

* fix: add reauthenticate method

* fix: add test

* Update types/hapi__nes/lib/client.d.ts

Co-Authored-By: Rodrigo Saboya <saboya@users.noreply.github.com>
This commit is contained in:
Julian Hundeloh 2019-07-23 21:36:37 +02:00 committed by Wesley Wigham
parent 5e51687559
commit 87f5dc0c2e
2 changed files with 4 additions and 0 deletions

View File

@ -22,6 +22,7 @@ declare class Client {
unsubscribe(path: string, handler?: Client.Handler): Promise<any>;
subscriptions(): string[];
overrideReconnectionAuth(auth: any): void;
reauthenticate(auth: any): Promise<true>;
}
declare namespace Client {

View File

@ -15,5 +15,8 @@ import NesClient = require('@hapi/nes/lib/client');
var client = new NesClient.Client('ws://localhost');
client.connect({ auth: { headers: { authorization: 'Basic am9objpzZWNyZXQ=' } } }).then(() => {
return client.reauthenticate({ headers: { authorization: 'Bearer am9objpzZWNyZXQ=' } });
}).then(() => {
return client.request('hello');
});