File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -189,6 +189,22 @@ describe('request', function () {
189
189
. then ( done , done ) ;
190
190
} ) ;
191
191
192
+ it ( 'agent can be used to set default baerer authentication' , function ( done ) {
193
+ var agent = request . agent ( 'https://httpbin.org' ) ;
194
+ agent . set ( "Authorization" , "Bearer test_bearer" ) ;
195
+
196
+ agent
197
+ . get ( '/bearer' )
198
+ . then ( function ( res ) {
199
+ res . should . have . status ( 200 ) ;
200
+ res . should . be . json ;
201
+ res . body . should . have . property ( 'authenticated' ) . that . equals ( true ) ;
202
+ res . body . should . have . property ( 'token' ) . that . equals ( "test_bearer" ) ;
203
+ agent . close ( ) ;
204
+ } )
205
+ . then ( done , done ) ;
206
+ } ) ;
207
+
192
208
it ( 'agent can be used to set default basic authentication' , function ( done ) {
193
209
var agent = request . agent ( 'https://httpbin.org' ) ;
194
210
agent . auth ( "user" , "passwd" ) ;
You can’t perform that action at this time.
0 commit comments