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

hono

Package Overview
Dependencies
Maintainers
1
Versions
347
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hono - npm Package Compare versions

Comparing version 2.0.7 to 2.0.8

6

dist/compose.d.ts
import type { ErrorHandler, NotFoundHandler } from './hono';
export declare const compose: <C>(middleware: Function[], onError?: ErrorHandler, onNotFound?: NotFoundHandler) => (context: C, next?: Function) => Promise<C>;
export declare const compose: <C>(middleware: Function[], onError?: ErrorHandler<{
[x: string]: any;
}> | undefined, onNotFound?: NotFoundHandler<{
[x: string]: any;
}> | undefined) => (context: C, next?: Function | undefined) => Promise<C>;

3

dist/compose.js

@@ -7,2 +7,3 @@ "use strict";

const compose = (middleware, onError, onNotFound) => {
const middlewareLength = middleware.length;
return (context, next) => {

@@ -17,3 +18,3 @@ let index = -1;

index = i;
if (i === middleware.length && next)
if (i === middlewareLength && next)
handler = next;

@@ -20,0 +21,0 @@ if (!handler) {

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

this._headers || (this._headers = {});
this._headers[name] = value;
this._headers[name.toLowerCase()] = value;
if (this.finalized) {

@@ -66,3 +66,3 @@ this.res.headers.set(name, value);

newResponse(data, status, headers = {}) {
const _headers = { ...this._headers, ...headers };
const _headers = { ...this._headers };
if (this._res) {

@@ -75,3 +75,3 @@ this._res.headers.forEach((v, k) => {

status: status || this._status || 200,
headers: _headers,
headers: { ..._headers, ...headers },
});

@@ -83,3 +83,3 @@ }

text(text, status = this._status, headers = {}) {
headers['Content-Type'] || (headers['Content-Type'] = 'text/plain; charset=UTF-8');
headers['content-type'] = 'text/plain; charset=UTF-8';
return this.body(text, status, headers);

@@ -91,7 +91,7 @@ }

: JSON.stringify(object);
headers['Content-Type'] || (headers['Content-Type'] = 'application/json; charset=UTF-8');
headers['content-type'] = 'application/json; charset=UTF-8';
return this.body(body, status, headers);
}
html(html, status = this._status, headers = {}) {
headers['Content-Type'] || (headers['Content-Type'] = 'text/html; charset=UTF-8');
headers['content-type'] = 'text/html; charset=UTF-8';
return this.body(html, status, headers);

@@ -111,3 +111,3 @@ }

const cookie = (0, cookie_1.serialize)(name, value, opt);
this.header('Set-Cookie', cookie);
this.header('set-cookie', cookie);
}

@@ -114,0 +114,0 @@ notFound() {

@@ -53,5 +53,5 @@ /// <reference types="@cloudflare/workers-types" />

handleEvent(event: FetchEvent): Promise<Response>;
fetch: (request: Request, env?: E, executionCtx?: ExecutionContext) => Promise<Response>;
fetch: (request: Request, env?: E | undefined, executionCtx?: ExecutionContext | undefined) => Promise<Response>;
request(input: RequestInfo, requestInit?: RequestInit): Promise<Response>;
}
export {};

@@ -7,3 +7,3 @@ import type { Context } from '../../context';

}
export declare const compress: (options?: CompressionOptions) => (ctx: Context, next: Next) => Promise<void>;
export declare const compress: (options?: CompressionOptions | undefined) => (ctx: Context, next: Next) => Promise<void>;
export {};

@@ -11,3 +11,3 @@ import type { Context } from '../../context';

};
export declare const cors: (options?: CORSOptions) => (c: Context, next: Next) => Promise<void>;
export declare const cors: (options?: CORSOptions | undefined) => (c: Context, next: Next) => Promise<void>;
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.etag = void 0;
const body_1 = require("../../utils/body");
const crypto_1 = require("../../utils/crypto");

@@ -12,4 +11,3 @@ const etag = (options = { weak: false }) => {

const clone = res.clone();
const body = await (0, body_1.parseBody)(res);
const hash = await (0, crypto_1.sha1)(body);
const hash = await (0, crypto_1.sha1)(res.body || '');
const etag = options.weak ? `W/"${hash}"` : `"${hash}"`;

@@ -16,0 +14,0 @@ if (ifNoneMatch && ifNoneMatch === etag) {

export declare const equal: (a: ArrayBuffer, b: ArrayBuffer) => boolean;
export declare const timingSafeEqual: (a: string | object | boolean, b: string | object | boolean, hashFunction?: Function) => Promise<boolean>;
export declare const timingSafeEqual: (a: string | object | boolean, b: string | object | boolean, hashFunction?: Function | undefined) => Promise<boolean>;
export declare const bufferToString: (buffer: ArrayBuffer) => string;

@@ -6,2 +6,2 @@ /// <reference types="@cloudflare/workers-types" />

};
export declare const getContentFromKVAsset: (path: string, options?: KVAssetOptions) => Promise<ArrayBuffer | null>;
export declare const getContentFromKVAsset: (path: string, options?: KVAssetOptions | undefined) => Promise<ArrayBuffer | null>;

@@ -5,3 +5,3 @@ declare type Algorithm = {

};
declare type Data = string | boolean | number | object | ArrayBufferView | ArrayBuffer;
declare type Data = string | boolean | number | object | ArrayBufferView | ArrayBuffer | ReadableStream;
export declare const sha256: (data: Data) => Promise<string | null>;

@@ -8,0 +8,0 @@ export declare const sha1: (data: Data) => Promise<string | null>;

@@ -24,2 +24,11 @@ "use strict";

let sourceBuffer;
if (data instanceof ReadableStream) {
let body = '';
const reader = data.getReader();
await reader?.read().then(async (chuck) => {
const value = await (0, exports.createHash)(chuck.value || '', algorithm);
body += value;
});
return body;
}
if (ArrayBuffer.isView(data) || data instanceof ArrayBuffer) {

@@ -26,0 +35,0 @@ sourceBuffer = data;

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

html: 'text/html',
ico: 'image/vnd.microsoft.icon',
ico: 'image/x-icon',
ics: 'text/calendar',

@@ -40,0 +40,0 @@ jar: 'application/java-archive',

{
"name": "hono",
"version": "2.0.7",
"version": "2.0.8",
"description": "Ultrafast web framework for Cloudflare Workers.",

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

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