Skip to content

Commit 5b20e78

Browse files
committed
added opts to pass to underlying http client, #229
1 parent 57b52bf commit 5b20e78

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

lib/swagger-client.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ SwaggerClient.prototype.initialize = function (url, options) {
357357
this.options = options;
358358

359359
if (typeof options.success === 'function') {
360+
this.ready = true;
360361
this.build();
361362
}
362363
};
@@ -1309,7 +1310,7 @@ var Property = function(name, obj, required) {
13091310
this.optional = true;
13101311
this.optional = !required;
13111312
this.default = obj.default || null;
1312-
this.example = obj.example || null;
1313+
this.example = obj.example !== undefined ? obj.example : null;
13131314
this.collectionFormat = obj.collectionFormat || null;
13141315
this.maximum = obj.maximum || null;
13151316
this.exclusiveMaximum = obj.exclusiveMaximum || null;
@@ -1612,6 +1613,7 @@ SwaggerClient.prototype.buildFrom1_2Spec = function (response) {
16121613
SwaggerClient.prototype.finish = function() {
16131614
if (typeof this.success === 'function') {
16141615
this.isValid = true;
1616+
this.ready = true;
16151617
this.isBuilt = true;
16161618
this.selfReflect();
16171619
this.success();

lib/swagger-client.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/js/swagger-a.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) {
747747
if(opts.mock === true)
748748
return obj;
749749
else
750-
new SwaggerHttp().execute(obj);
750+
new SwaggerHttp().execute(obj, opts);
751751
};
752752

753753
Operation.prototype.setContentTypes = function(args, opts) {

src/js/swaggerHttp.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44
var SwaggerHttp = function() {};
55

6-
SwaggerHttp.prototype.execute = function(obj) {
6+
SwaggerHttp.prototype.execute = function(obj, opts) {
77
if(obj && (typeof obj.useJQuery === 'boolean'))
88
this.useJQuery = obj.useJQuery;
99
else
@@ -14,9 +14,9 @@ SwaggerHttp.prototype.execute = function(obj) {
1414
}
1515

1616
if(this.useJQuery)
17-
return new JQueryHttpClient().execute(obj);
17+
return new JQueryHttpClient(opts).execute(obj);
1818
else
19-
return new ShredHttpClient().execute(obj);
19+
return new ShredHttpClient(opts).execute(obj);
2020
};
2121

2222
SwaggerHttp.prototype.isIE8 = function() {
@@ -124,8 +124,8 @@ JQueryHttpClient.prototype.execute = function(obj) {
124124
/*
125125
* ShredHttpClient is a light-weight, node or browser HTTP client
126126
*/
127-
var ShredHttpClient = function(options) {
128-
this.options = (options||{});
127+
var ShredHttpClient = function(opts) {
128+
this.opts = (opts||{});
129129
this.isInitialized = false;
130130

131131
var identity, toString;
@@ -136,7 +136,7 @@ var ShredHttpClient = function(options) {
136136
}
137137
else
138138
this.Shred = require("shred");
139-
this.shred = new this.Shred(options);
139+
this.shred = new this.Shred(opts);
140140
};
141141

142142
ShredHttpClient.prototype.initShred = function () {

0 commit comments

Comments
 (0)