Comparing version 1.9.2 to 1.9.3
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Filters = /** @class */ (function () { | ||
var Filters = (function () { | ||
function Filters() { | ||
@@ -5,0 +5,0 @@ } |
@@ -6,3 +6,3 @@ "use strict"; | ||
var Headers_1 = require("./Headers"); | ||
var Request = /** @class */ (function () { | ||
var Request = (function () { | ||
function Request(method, uri, body, headers) { | ||
@@ -9,0 +9,0 @@ if (body === void 0) { body = ""; } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Response = /** @class */ (function () { | ||
var Response = (function () { | ||
function Response(status, body, headers) { | ||
@@ -5,0 +5,0 @@ if (status === void 0) { status = 200; } |
@@ -6,3 +6,3 @@ "use strict"; | ||
var NativeServer_1 = require("../servers/NativeServer"); | ||
var Routing = /** @class */ (function () { | ||
var Routing = (function () { | ||
function Routing(method, path, headers, handler) { | ||
@@ -9,0 +9,0 @@ if (headers === void 0) { headers = {}; } |
@@ -5,4 +5,4 @@ "use strict"; | ||
var pathParamMatchingRegex = new RegExp(/\{(\w+)\}/g); | ||
var pathParamCaptureTemplate = "([\\w\\s\-]+)"; | ||
var Uri = /** @class */ (function () { | ||
var pathParamCaptureTemplate = "([\\w\\s\-\%]+)"; | ||
var Uri = (function () { | ||
function Uri(template) { | ||
@@ -77,8 +77,7 @@ this.matches = {}; | ||
var _this = this; | ||
var decodedUri = decodeURI(uri); | ||
var pathParamNames = this.path().match(pathParamMatchingRegex) | ||
.map(function (it) { return it.replace("{", "").replace("}", ""); }); | ||
var pathParams = Uri.uriTemplateToPathParamCapturingRegex(this.path()).exec(decodedUri); | ||
var pathParams = Uri.uriTemplateToPathParamCapturingRegex(this.path()).exec(uri); | ||
pathParamNames.map(function (name, i) { | ||
_this.matches[name] = pathParams[i + 1]; | ||
_this.matches[name] = decodeURIComponent(pathParams[i + 1]); | ||
}); | ||
@@ -85,0 +84,0 @@ return this; |
@@ -5,3 +5,3 @@ import {KeyValues} from "./HttpMessage"; | ||
const pathParamMatchingRegex: RegExp = new RegExp(/\{(\w+)\}/g); | ||
const pathParamCaptureTemplate: string = "([\\w\\s\-]+)"; | ||
const pathParamCaptureTemplate: string = "([\\w\\s\-\%]+)"; | ||
@@ -106,8 +106,7 @@ export interface NodeURI { | ||
extract(uri: string): Uri { | ||
const decodedUri = decodeURI(uri); | ||
const pathParamNames = this.path().match(pathParamMatchingRegex) | ||
.map(it => it.replace("{", "").replace("}", "")); | ||
const pathParams = Uri.uriTemplateToPathParamCapturingRegex(this.path()).exec(decodedUri); | ||
const pathParams = Uri.uriTemplateToPathParamCapturingRegex(this.path()).exec(uri); | ||
pathParamNames.map( (name, i) => { | ||
this.matches[name] = pathParams[i+1] | ||
this.matches[name] = decodeURIComponent(pathParams[i+1]); | ||
}); | ||
@@ -131,2 +130,2 @@ return this; | ||
} | ||
} | ||
} |
26
index.js
@@ -5,15 +5,13 @@ "use strict"; | ||
} | ||
exports.__esModule = true; | ||
var Request_1 = require("./dist/core/Request"); | ||
__export(require("./dist/core/Routing")); | ||
__export(require("./dist/core/Request")); | ||
__export(require("./dist/core/Response")); | ||
__export(require("./dist/core/Uri")); | ||
__export(require("./dist/core/Headers")); | ||
__export(require("./dist/core/Methods")); | ||
__export(require("./dist/core/Filters")); | ||
__export(require("./dist/core/Status")); | ||
__export(require("./dist/servers/ExpressServer")); | ||
__export(require("./dist/servers/KoaServer")); | ||
__export(require("./dist/client/Client")); | ||
var x = Request_1.Req("GET", "/").pathParams.userId; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./core/Routing")); | ||
__export(require("./core/Request")); | ||
__export(require("./core/Response")); | ||
__export(require("./core/Uri")); | ||
__export(require("./core/Headers")); | ||
__export(require("./core/Methods")); | ||
__export(require("./core/Filters")); | ||
__export(require("./core/Status")); | ||
__export(require("./servers/ExpressServer")); | ||
__export(require("./servers/KoaServer")); | ||
__export(require("./client/Client")); |
{ | ||
"name": "http4js", | ||
"version": "1.9.2", | ||
"version": "1.9.3", | ||
"description": "A lightweight HTTP toolkit", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Request_1 = require("../core/Request"); | ||
var ExpressServer = /** @class */ (function () { | ||
var ExpressServer = (function () { | ||
function ExpressServer(expressApp, port) { | ||
@@ -6,0 +6,0 @@ this.port = port; |
@@ -39,3 +39,3 @@ "use strict"; | ||
var Request_1 = require("../core/Request"); | ||
var KoaServer = /** @class */ (function () { | ||
var KoaServer = (function () { | ||
function KoaServer(koaApp, port) { | ||
@@ -42,0 +42,0 @@ this.port = port; |
@@ -6,3 +6,3 @@ "use strict"; | ||
var Headers_1 = require("../core/Headers"); | ||
var NativeServer = /** @class */ (function () { | ||
var NativeServer = (function () { | ||
function NativeServer(port) { | ||
@@ -9,0 +9,0 @@ this.port = port; |
@@ -8,4 +8,3 @@ { | ||
"include": [ | ||
"src/main/**/*", | ||
"index" | ||
"src/main/**/*" | ||
], | ||
@@ -12,0 +11,0 @@ "exclude": [ |
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
77752
47
1973
3