Comparing version 0.6.0 to 0.6.1
@@ -151,19 +151,21 @@ "use strict"; | ||
} | ||
const parseQuery = (searchParams) => { | ||
const queryMap = new Object(); | ||
for (const [key, value] of searchParams) { | ||
const parameterName = decodeURIComponent(key); | ||
const parameterValue = decodeURIComponent(value); | ||
let existingEntry = queryMap[parameterName]; | ||
if (!existingEntry) { | ||
existingEntry = new Array(); | ||
queryMap[parameterName] = existingEntry; | ||
} | ||
existingEntry.push(parameterValue); | ||
} | ||
const query = new HttpQueryParameters(queryMap); | ||
return query; | ||
}; | ||
class HttpRequestBuilder { | ||
static fromPath(requestData) { | ||
const url = new URL("file://" + requestData.path); | ||
const queryMap = new Object(); | ||
const queryString = url.search.substring(1); | ||
for (const entry of queryString.split("&")) { | ||
const pair = entry.split("="); | ||
const parameterName = decodeURIComponent(pair[0]); | ||
const parameterValue = decodeURIComponent(pair[1]); | ||
let existingEntry = queryMap[parameterName]; | ||
if (!existingEntry) { | ||
existingEntry = new Array(); | ||
queryMap[parameterName] = existingEntry; | ||
} | ||
existingEntry.push(parameterValue); | ||
} | ||
const query = new HttpQueryParameters(queryMap); | ||
const query = parseQuery(url.searchParams); | ||
const request = { | ||
@@ -170,0 +172,0 @@ timestamp: requestData.timestamp ? requestData.timestamp : undefined, |
{ | ||
"name": "http-types", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "Library for JSON serialisation of HTTP exchanges", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -1,2 +0,2 @@ | ||
# ts-http-types | ||
# HTTP Types in TypeScript | ||
[![Build Status](https://github.com/Meeshkan/ts-http-types/workflows/Node.js%20CI/badge.svg)](https://github.com/Meeshkan/ts-http-types/actions?query=workflow%3A%22Node.js+CI%22) | ||
@@ -3,0 +3,0 @@ [![MIT licensed](http://img.shields.io/:license-MIT-blue.svg)](LICENSE) |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
30738
9
519
1