This repository was archived by the owner on Mar 11, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +7
-12
lines changed
Expand file tree Collapse file tree 3 files changed +7
-12
lines changed Original file line number Diff line number Diff line change 11# Unreleased
22- [ FIXED] Parsing of max-age from Set-Cookie headers.
3+ - [ FIXED] Double callback if plugin errors when updating state.
34
45# 4.3.1 (2021-03-17)
56- [ NEW] Add migration guide to the newly supported cloudant-node-sdk
Original file line number Diff line number Diff line change 1- // Copyright © 2015, 2019 IBM Corp. All rights reserved.
1+ // Copyright © 2015, 2021 IBM Corp. All rights reserved.
22//
33// Licensed under the Apache License, Version 2.0 (the "License");
44// you may not use this file except in compliance with the License.
@@ -68,16 +68,13 @@ class CookiePlugin extends BasePlugin {
6868 delete req . url ;
6969 req . uri = u . format ( new u . URL ( req . uri ) , { auth : false } ) ;
7070
71- self . _tokenManager . renewIfRequired ( ) . then ( ( ) => {
72- callback ( state ) ;
73- } ) . catch ( ( error ) => {
71+ self . _tokenManager . renewIfRequired ( ) . catch ( ( error ) => {
7472 if ( state . attempt < state . maxAttempt ) {
7573 state . retry = true ;
7674 } else {
7775 state . abortWithResponse = [ error ] ; // return error to client
7876 }
79- callback ( state ) ;
80- } ) ;
77+ } ) . finally ( ( ) => callback ( state ) ) ;
8178 }
8279
8380 onResponse ( state , response , callback ) {
Original file line number Diff line number Diff line change 1- // Copyright © 2017, 2019 IBM Corp. All rights reserved.
1+ // Copyright © 2017, 2021 IBM Corp. All rights reserved.
22//
33// Licensed under the Apache License, Version 2.0 (the "License");
44// you may not use this file except in compliance with the License.
@@ -66,9 +66,7 @@ class IAMPlugin extends BasePlugin {
6666 delete req . url ;
6767 req . uri = u . format ( new u . URL ( req . uri ) , { auth : false } ) ;
6868
69- self . _tokenManager . renewIfRequired ( ) . then ( ( ) => {
70- callback ( state ) ;
71- } ) . catch ( ( error ) => {
69+ self . _tokenManager . renewIfRequired ( ) . catch ( ( error ) => {
7270 debug ( error ) ;
7371 if ( state . attempt < state . maxAttempt ) {
7472 state . retry = true ;
@@ -85,8 +83,7 @@ class IAMPlugin extends BasePlugin {
8583 } else {
8684 state . abortWithResponse = [ error ] ; // return error to client
8785 }
88- callback ( state ) ;
89- } ) ;
86+ } ) . finally ( ( ) => callback ( state ) ) ;
9087 }
9188
9289 onResponse ( state , response , callback ) {
You can’t perform that action at this time.
0 commit comments