Skip to content
Browse files

only send http_proxy params if soure == http_proxy

  • Loading branch information...
1 parent 44ce4cb commit 75cee15309eeec284bdeaa424d936ccdc2758f50 Frederik Dietz committed Aug 9, 2012
View
4 app/assets/javascripts/models/boolean.js
@@ -15,7 +15,7 @@
url: function() {
var params = ['source=' + encodeURIComponent(this.source)];
- if (this.http_proxy_url) {
+ if (this.source === "http_proxy" && this.http_proxy_url) {
params.push("http_proxy_url=" + encodeURIComponent(this.http_proxy_url));
}
return "/api/boolean?" + params.join('&');
@@ -28,7 +28,7 @@
return 0;
}
- if (path && path.length > 0) {
+ if (this.source === "http_proxy" && path && path.length > 0) {
return this.resolvePath(path);
} else {
return this.get("value");
View
4 app/assets/javascripts/models/number.js
@@ -15,7 +15,7 @@
url: function() {
var params = ['source=' + encodeURIComponent(this.source)];
- if (this.http_proxy_url) {
+ if (this.source === "http_proxy" && this.http_proxy_url) {
params.push("http_proxy_url=" + encodeURIComponent(this.http_proxy_url));
}
return "/api/number?" + params.join('&');
@@ -28,7 +28,7 @@
return 0;
}
- if (path && path.length > 0) {
+ if (this.source === "http_proxy" && path && path.length > 0) {
return this.resolvePath(path);
} else {
return this.get("value");
View
15 spec/javascripts/models/number_spec.js
@@ -1,10 +1,8 @@
describe("Number Model", function() {
- beforeEach(function() {
- this.model = new window.app.models.Number({ source: "demo" });
- });
it("builds url for given source param", function() {
- expect(this.model.url()).toEqual("/api/number?source=demo");
+ model = new window.app.models.Number({ source: "demo" });
+ expect(model.url()).toEqual("/api/number?source=demo");
});
describe("#resolveValue", function() {
@@ -17,10 +15,11 @@ describe("Number Model", function() {
}
};
- this.model.populated = true;
- this.model.attributes = input;
- this.model.set("value_path", "parent.child.key");
- expect(this.model.resolveValue()).toEqual("value");
+ model = new window.app.models.Number({ source: "http_proxy" });
+ model.populated = true;
+ model.attributes = input;
+ model.set("value_path", "parent.child.key");
+ expect(model.resolveValue()).toEqual("value");
});
});
});

0 comments on commit 75cee15

Please sign in to comment.
Something went wrong with that request. Please try again.