@@ -197,6 +197,20 @@ describe('#prepareSecurity()', () => {
197197 } ) ;
198198 } ) ;
199199
200+ it ( 'apiKey/cookie: should return with a type of Cookie' , ( ) => {
201+ const oas = createSecurityOas ( {
202+ securityScheme : {
203+ type : 'apiKey' ,
204+ in : 'cookie' ,
205+ } ,
206+ } ) ;
207+ const operation = oas . operation ( path , method ) ;
208+
209+ expect ( operation . prepareSecurity ( ) ) . toStrictEqual ( {
210+ Cookie : [ oas . components . securitySchemes . securityScheme ] ,
211+ } ) ;
212+ } ) ;
213+
200214 it ( 'should work for petstore' , ( ) => {
201215 const operation = new Oas ( petstore ) . operation ( '/pet' , 'post' ) ;
202216
@@ -224,9 +238,6 @@ describe('#prepareSecurity()', () => {
224238
225239 it . todo ( 'should set a `key` property' ) ;
226240
227- // TODO We dont currently support cookies?
228- it . todo ( 'apiKey/cookie: should return with a type of Cookie' ) ;
229-
230241 it . todo ( 'should throw if attempting to use a non-existent scheme' ) ;
231242
232243 it ( 'should return empty object if no security' , ( ) => {
@@ -311,7 +322,7 @@ describe('#getHeaders()', () => {
311322 const operation = new Operation ( oas , logOperation . url . path , logOperation . url . method , logOperation . operation ) ;
312323
313324 expect ( operation . getHeaders ( ) ) . toMatchObject ( {
314- request : [ 'Cookie ' , 'Authorization ' , 'Accept' ] ,
325+ request : [ 'Authorization ' , 'Cookie ' , 'Accept' ] ,
315326 response : [ 'Content-Type' ] ,
316327 } ) ;
317328 } ) ;
0 commit comments