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

@http4t/core

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@http4t/core - npm Package Compare versions

Comparing version 0.0.156 to 0.0.158

@@ -7,4 +7,4 @@ import { HttpHandler, HttpRequest, HttpResponse } from "./contract";

handle(request: HttpRequest): Promise<HttpResponse>;
static echo({ uri, headers, body }: HttpRequest): Promise<HttpResponse>;
static echo({ headers, body }: HttpRequest): Promise<HttpResponse>;
streamBytes(size: number): HttpResponse;
}

@@ -79,5 +79,5 @@ "use strict";

return __awaiter(this, void 0, void 0, function () {
var method, _a, path, query, match;
return __generator(this, function (_b) {
method = request.method, _a = request.uri, path = _a.path, query = _a.query;
var method, path, match;
return __generator(this, function (_a) {
method = request.method, path = request.uri.path;
if (method === 'GET' && path.startsWith('/stream-bytes')) {

@@ -102,3 +102,3 @@ match = /\/stream-bytes\/(.+)/.exec(path);

BinHandler.echo = function (_a) {
var uri = _a.uri, headers = _a.headers, body = _a.body;
var headers = _a.headers, body = _a.body;
return __awaiter(this, void 0, void 0, function () {

@@ -105,0 +105,0 @@ var jsonedHeaders, _b, _c, _d, _e;

@@ -11,3 +11,3 @@ import {Random} from "./util/random";

async handle(request: HttpRequest): Promise<HttpResponse> {
const {method, uri: {path, query}} = request;
const {method, uri: {path}} = request;

@@ -27,3 +27,3 @@ if (method === 'GET' && path.startsWith('/stream-bytes')) {

static async echo({uri, headers, body}: HttpRequest): Promise<HttpResponse> {
static async echo({headers, body}: HttpRequest): Promise<HttpResponse> {
// TODO convert headers to object instead of array

@@ -30,0 +30,0 @@ const jsonedHeaders = headers.reduce((acc: any, [n, v]) => {

@@ -67,8 +67,9 @@ "use strict";

var lowerCaseName = name.toLowerCase();
return headers.filter(function (_a) {
var _b = __read(_a, 2), name = _b[0], value = _b[1];
return headers
.filter(function (_a) {
var _b = __read(_a, 2), name = _b[0], _ = _b[1];
return name.toLowerCase() === lowerCaseName;
})
.map(function (_a) {
var _b = __read(_a, 2), name = _b[0], value = _b[1];
var _b = __read(_a, 2), _ = _b[0], value = _b[1];
return value;

@@ -75,0 +76,0 @@ });

@@ -24,4 +24,5 @@ import {Header, HeaderName, HeaderValue} from './contract';

const lowerCaseName = name.toLowerCase();
return headers.filter(([name, value]) => name.toLowerCase() === lowerCaseName)
.map(([name, value]) => value)
return headers
.filter(([name, _]) => name.toLowerCase() === lowerCaseName)
.map(([_, value]) => value)
}

@@ -28,0 +29,0 @@

{
"name": "@http4t/core",
"version": "0.0.156",
"version": "0.0.158",
"license": "Apache-2.0"
}

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

}).map(function (_a) {
var _b = __read(_a, 2), n = _b[0], v = _b[1];
var _b = __read(_a, 2), _ = _b[0], v = _b[1];
return v;

@@ -94,0 +94,0 @@ });

@@ -61,3 +61,3 @@ import {DecodedPair, decodePairs, encodePairs} from "./urlEncoding";

export function queries(query: string | undefined, name: string): (string | undefined)[] {
return decodePairs(query).filter(([n]) => n === name).map(([n, v]) => v);
return decodePairs(query).filter(([n]) => n === name).map(([_, v]) => v);
}

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

Regex.prototype.matches = function (against) {
var regex, start, nonMatch, rest, match, end;
var regex, start, nonMatch, match, end;
return __generator(this, function (_a) {

@@ -51,3 +51,2 @@ switch (_a.label) {

nonMatch = '';
rest = '';
_a.label = 1;

@@ -60,3 +59,3 @@ case 1:

start = end + match[0].length;
rest = against.slice(start);
// rest = against.slice(start);
this.matched.push(match);

@@ -63,0 +62,0 @@ this.nonMatched.push(nonMatch);

@@ -18,3 +18,3 @@ export class Regex {

let nonMatch = '';
let rest = '';
// let rest = '';
let match;

@@ -26,3 +26,3 @@ while (match = regex.exec(against)) {

start = end + match[0].length;
rest = against.slice(start);
// rest = against.slice(start);
this.matched.push(match);

@@ -35,2 +35,2 @@ this.nonMatched.push(nonMatch);

}
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet