Comparing version
@@ -13,2 +13,3 @@ const req = require("request") | ||
this.timeoutVal = 20000 | ||
this.gzip = false | ||
} | ||
@@ -20,2 +21,9 @@ | ||
compression(val) { | ||
if (DarkSky.truthyOrZero(val)) { | ||
this.gzip = val | ||
} | ||
return this | ||
} | ||
longitude(long) { | ||
@@ -140,3 +148,3 @@ if (DarkSky.truthyOrZero(long)) { | ||
req( | ||
{ url: this.url, json: true, timeout: this.timeoutVal }, | ||
{ url: this.url, json: true, timeout: this.timeoutVal, gzip: this.gzip }, | ||
(err, res, body) => { | ||
@@ -143,0 +151,0 @@ if (err) { |
@@ -42,1 +42,14 @@ const DarkSky = require("./dark-sky-api") | ||
}) | ||
test("return the current forecast for Toronto using compression", async () => { | ||
const darksky = new DarkSky(process.env.DARK_SKY) | ||
const result = await darksky | ||
.coordinates({ | ||
lat: 43.761539, | ||
lng: -79.411079 | ||
}) | ||
.compression(true) | ||
.get() | ||
expect(result.latitude).toBe(43.761539) | ||
expect(result.longitude).toBe(-79.411079) | ||
}) |
{ | ||
"name": "dark-sky", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": | ||
@@ -5,0 +5,0 @@ "A dead simple Dark Sky API wrapper for Nodejs using method chaining and promises.", |
118434
0.44%3192
0.6%4
33.33%