Comparing version 2.7.0 to 2.7.1
@@ -30,3 +30,3 @@ "use strict"; | ||
BaseClient.prototype.setClientOptions = function (configOptions) { | ||
this.clientOptions = configOptions; | ||
this.clientOptions = __assign({}, BaseClient.DefaultOptions, configOptions); | ||
this.buildDefaultHttpClient(); | ||
@@ -147,2 +147,3 @@ }; | ||
maxContentLength: Infinity, | ||
maxBodyLength: Infinity, | ||
validateStatus: function (status) { | ||
@@ -180,3 +181,3 @@ return status >= 200 && status < 300; | ||
requestHost: "api.postmarkapp.com", | ||
timeout: 60, | ||
timeout: 180, | ||
}; | ||
@@ -183,0 +184,0 @@ return BaseClient; |
export declare namespace ClientOptions { | ||
class Configuration { | ||
useHttps: boolean; | ||
requestHost: string; | ||
timeout: number; | ||
constructor(useHttps: boolean, requestHost: string, timeout: number); | ||
useHttps?: boolean; | ||
requestHost?: string; | ||
timeout?: number; | ||
constructor(useHttps?: boolean, requestHost?: string, timeout?: number); | ||
} | ||
@@ -8,0 +8,0 @@ enum HttpMethod { |
@@ -12,3 +12,3 @@ { | ||
], | ||
"version": "2.7.0", | ||
"version": "2.7.1", | ||
"author": "Igor Balos", | ||
@@ -15,0 +15,0 @@ "contributors": [ |
@@ -27,3 +27,3 @@ import * as postmark from "../../src/index"; | ||
requestHost: "api.postmarkapp.com", | ||
timeout: 60, | ||
timeout: 180, | ||
}); | ||
@@ -57,2 +57,24 @@ }); | ||
it("set clientOptions timeout", () => { | ||
const timeoutValue: number = 10; | ||
client.setClientOptions({timeout: timeoutValue}); | ||
expect(client.getClientOptions()).to.eql({ | ||
useHttps: true, | ||
requestHost: "api.postmarkapp.com", | ||
timeout: timeoutValue, | ||
}); | ||
}); | ||
it("set clientOptions https", () => { | ||
const https: boolean = false; | ||
client.setClientOptions({useHttps: https}); | ||
expect(client.getClientOptions()).to.eql({ | ||
useHttps: https, | ||
requestHost: "api.postmarkapp.com", | ||
timeout: 180, | ||
}); | ||
}); | ||
describe("errors", () => { | ||
@@ -59,0 +81,0 @@ it("empty token", () => { |
@@ -23,3 +23,3 @@ import * as postmark from "../../src/index"; | ||
it("default clientOptions", () => { | ||
const defaultClientOptions = { useHttps: true, requestHost: "api.postmarkapp.com", timeout: 60 }; | ||
const defaultClientOptions = { useHttps: true, requestHost: "api.postmarkapp.com", timeout: 180 }; | ||
expect(client.getClientOptions()).to.eql(defaultClientOptions); | ||
@@ -61,2 +61,23 @@ }); | ||
it("set clientOptions timeout", () => { | ||
const timeoutValue: number = 10; | ||
client.setClientOptions({timeout: timeoutValue}); | ||
expect(client.getClientOptions()).to.eql({ | ||
useHttps: true, | ||
requestHost: "api.postmarkapp.com", | ||
timeout: timeoutValue, | ||
}); | ||
}); | ||
it("set clientOptions https", () => { | ||
client.setClientOptions({useHttps: false}); | ||
expect(client.getClientOptions()).to.eql({ | ||
useHttps: false, | ||
requestHost: "api.postmarkapp.com", | ||
timeout: 180, | ||
}); | ||
}); | ||
it("new clientOptions as object", () => { | ||
@@ -63,0 +84,0 @@ const requestHost = "test"; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
283543
5004