New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

http4js

Package Overview
Dependencies
Maintainers
1
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http4js - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

4

dist/main/core/RoutingHttpHandler.js

@@ -73,3 +73,3 @@ "use strict";

var exactMatch = paths.find(function (handlerPath) {
return request.uri.match(handlerPath) && _this.handlers[handlerPath].verb == request.method;
return request.uri.templateMatch(handlerPath) && _this.handlers[handlerPath].verb == request.method;
});

@@ -79,3 +79,3 @@ var fuzzyMatch = paths.find(function (handlerPath) {

? false
: Uri_1.Uri.of(handlerPath).match(request.uri.path) && _this.handlers[handlerPath].verb == request.method;
: handlerPath.includes("{") && Uri_1.Uri.of(handlerPath).templateMatch(request.uri.path) && _this.handlers[handlerPath].verb == request.method;
});

@@ -82,0 +82,0 @@ var match = exactMatch || fuzzyMatch;

@@ -14,3 +14,3 @@ export declare class Uri {

static of(uri: string): Uri;
match(path: string): boolean;
templateMatch(path: string): boolean;
extract(uri: string): Uri;

@@ -17,0 +17,0 @@ pathParam(name: string): string;

@@ -23,3 +23,3 @@ "use strict";

};
Uri.prototype.match = function (path) {
Uri.prototype.templateMatch = function (path) {
var exec = this.uriTemplateToPathParamCapturingRegex().exec(path);

@@ -26,0 +26,0 @@ return exec != null;

@@ -126,2 +126,9 @@ "use strict";

});
it("matches path params only if specified a capture in route", function () {
var response = RoutingHttpHandler_1.getTo("/family", function () {
return new Response_1.Response(200, new Body_1.Body("losh,bosh,tosh"));
})
.match(new Request_1.Request("GET", "/family/123"));
assert_1.equal(response.bodyString(), "GET to /family/123 did not match routes");
});
});

@@ -16,7 +16,7 @@ "use strict";

assert_1.equal(Uri_1.Uri.of("/tom/{is}/goodness")
.match("/tom/is the sugar/goodness/gracious/me"), true);
.templateMatch("/tom/is the sugar/goodness/gracious/me"), true);
});
it("matches false when paths different", function () {
assert_1.equal(Uri_1.Uri.of("/tom/{is}/goodness")
.match("/tom/is/badness"), false);
.templateMatch("/tom/is/badness"), false);
});

@@ -23,0 +23,0 @@ it("parses out the path from uri string", function () {

{
"name": "http4js",
"version": "1.0.7",
"version": "1.0.8",
"description": "A lightweight HTTP toolkit",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc