From 87f5dc0c2eac70f8d8c2b18df2281058603dc91a Mon Sep 17 00:00:00 2001 From: Julian Hundeloh Date: Tue, 23 Jul 2019 21:36:37 +0200 Subject: [PATCH] (@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 --- types/hapi__nes/lib/client.d.ts | 1 + types/hapi__nes/test/route-authentication-client.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/types/hapi__nes/lib/client.d.ts b/types/hapi__nes/lib/client.d.ts index 4155971c19..6b900697c6 100644 --- a/types/hapi__nes/lib/client.d.ts +++ b/types/hapi__nes/lib/client.d.ts @@ -22,6 +22,7 @@ declare class Client { unsubscribe(path: string, handler?: Client.Handler): Promise; subscriptions(): string[]; overrideReconnectionAuth(auth: any): void; + reauthenticate(auth: any): Promise; } declare namespace Client { diff --git a/types/hapi__nes/test/route-authentication-client.ts b/types/hapi__nes/test/route-authentication-client.ts index df6a57aeab..e401d05562 100644 --- a/types/hapi__nes/test/route-authentication-client.ts +++ b/types/hapi__nes/test/route-authentication-client.ts @@ -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'); });