Comparing version 0.2.0 to 0.3.0
@@ -167,3 +167,2 @@ "use strict"; | ||
if (requestData.query) { | ||
path += "?"; | ||
let first = true; | ||
@@ -175,2 +174,3 @@ for (const key in requestData.query) { | ||
first = false; | ||
path += "?"; | ||
} | ||
@@ -189,2 +189,3 @@ else { | ||
first = false; | ||
path += "?"; | ||
} | ||
@@ -191,0 +192,0 @@ else { |
{ | ||
"name": "http-types", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Library for JSON serialisation of HTTP exchanges", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -218,3 +218,2 @@ /** HTTP request method to indicate the desired action to be performed for a given resource. */ | ||
if (requestData.query) { | ||
path += "?"; | ||
let first = true; | ||
@@ -226,2 +225,3 @@ for (const key in requestData.query) { | ||
first = false; | ||
path += "?"; | ||
} else { | ||
@@ -238,2 +238,3 @@ path += "&"; | ||
first = false; | ||
path += "?"; | ||
} else { | ||
@@ -240,0 +241,0 @@ path += "&"; |
@@ -156,1 +156,30 @@ import { | ||
}); | ||
test("Http exchanges from JSON with pathname and no query parameter", () => { | ||
const json = `{ | ||
"request": { | ||
"protocol": "https", | ||
"host": "example.com", | ||
"timestamp": "2018-11-13T20:20:39+02:00", | ||
"method": "post", | ||
"headers": { | ||
"accept": "*/*", | ||
"multi-value": ["value1", "value2"] | ||
}, | ||
"pathname": "/a/path", | ||
"query": {}, | ||
"body": "a request body" | ||
}, | ||
"response": { | ||
"timestamp": "2019-11-13T20:20:39+02:00", | ||
"statusCode": 404, | ||
"headers": { | ||
"content-length": "15", | ||
"Upper-Case": "yes" | ||
}, | ||
"body": "a response body" | ||
} | ||
}`; | ||
const exchange = HttpExchangeReader.fromJson(json); | ||
expect(exchange.request.path).toBe("/a/path"); | ||
}); |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
45765
1017
0