Skip to content

Commit 07a5289

Browse files
committed
added cookie support
1 parent 842e5fd commit 07a5289

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

lib/swagger.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// swagger.js
2-
// version 2.0.29
2+
// version 2.0.30
33

44
var __bind = function(fn, me){
55
return function(){
@@ -1475,6 +1475,16 @@ ApiKeyAuthorization.prototype.apply = function(obj, authorizations) {
14751475
}
14761476
};
14771477

1478+
var CookieAuthorization = function(cookie) {
1479+
this.cookie = cookie;
1480+
}
1481+
1482+
CookieAuthorization.prototype.apply = function(obj, authorizations) {
1483+
obj.cookieJar = obj.cookieJar || CookieJar();
1484+
obj.cookieJar.setCookie(this.cookie);
1485+
return true;
1486+
}
1487+
14781488
/**
14791489
* Password Authorization is a basic auth implementation
14801490
*/
@@ -1498,18 +1508,19 @@ PasswordAuthorization.prototype.apply = function(obj, authorizations) {
14981508
var e = (typeof window !== 'undefined' ? window : exports);
14991509

15001510
var sampleModels = {};
1511+
var cookies = {};
15011512

15021513
e.SampleModels = sampleModels;
15031514
e.SwaggerHttp = SwaggerHttp;
15041515
e.SwaggerRequest = SwaggerRequest;
15051516
e.authorizations = new SwaggerAuthorizations();
15061517
e.ApiKeyAuthorization = ApiKeyAuthorization;
15071518
e.PasswordAuthorization = PasswordAuthorization;
1519+
e.CookieAuthorization = CookieAuthorization;
15081520
e.JQueryHttpClient = JQueryHttpClient;
15091521
e.ShredHttpClient = ShredHttpClient;
15101522
e.SwaggerOperation = SwaggerOperation;
15111523
e.SwaggerModel = SwaggerModel;
15121524
e.SwaggerModelProperty = SwaggerModelProperty;
15131525
e.SwaggerResource = SwaggerResource;
15141526
e.SwaggerApi = SwaggerApi;
1515-

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
}
99
],
1010
"description": "swagger.js is a javascript client for use with swaggering APIs.",
11-
"version": "2.0.29",
11+
"version": "2.0.30",
1212
"homepage": "http://swagger.wordnik.com",
1313
"repository": {
1414
"type": "git",

0 commit comments

Comments
 (0)