Socket
Socket
Sign inDemoInstall

h3

Package Overview
Dependencies
Maintainers
1
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

h3 - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

2

dist/index.d.ts

@@ -49,3 +49,3 @@ import { IncomingMessage, ServerResponse } from 'http';

declare function use(app: App, arg1: string | Handle | InputLayer | InputLayer[], arg2?: Handle | Partial<InputLayer> | Handle[] | Middleware | Middleware[], arg3?: Partial<InputLayer>): App;
declare function createHandle(stack: Stack): PHandle;
declare function createHandle(stack: Stack, options: AppOptions): PHandle;

@@ -52,0 +52,0 @@ /**

{
"name": "h3",
"version": "0.3.1",
"version": "0.3.2",
"description": "Tiny JavaScript Server",

@@ -5,0 +5,0 @@ "repository": "unjs/h3",

@@ -81,3 +81,3 @@ [![d](https://img.shields.io/npm/dm/h3.svg?style=flat-square)](https://npmjs.com/package/h3)

- `useCookie(req, name)`
- `setCookie(req, name, value, opts?)`
- `setCookie(res, name, value, opts?)`
- `useQuery(req)`

@@ -92,3 +92,3 @@ - `send(res, data, type?)`

Using `createApp`, it returns a standard `(req, res)` handler function and internally an array called middleware stack. using`use()` method we can to add an item to this internal stack.
Using `createApp`, it returns a standard `(req, res)` handler function and internally an array called middleware stack. using`use()` method we can add an item to this internal stack.

@@ -99,6 +99,6 @@ When a request comes, each stack item that matches the route will be called and resolved until [`res.writableEnded`](https://nodejs.org/api/http.html#http_response_writableended) flag is set, which means the response is sent. If `writableEnded` is not set after all middleware, a `404` error will be thrown. And if one of the stack items resolves to a value, it will be serialized and sent as response as a shorthand method to sending responses.

- If middleware has 3rd next/callback param, promise will `resolve/reject` when called
- If middleware has 3rd next/callback param, the promise will `resolve/reject` when called
- If middleware returns a promise, it will be **chained** to the main promise
- If calling middleware throws an immediate error, promise will be rejected
- On `close` and `error` events of res, promise will `resolve/reject` (to ensure if middleware simply calls `res.end`)
- If calling middleware throws an immediate error, the promise will be rejected
- On `close` and `error` events of res, the promise will `resolve/reject` (to ensure if middleware simply calls `res.end`)

@@ -105,0 +105,0 @@ ## License

Sorry, the diff of this file is not supported yet

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