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

bun-types

Package Overview
Dependencies
Maintainers
3
Versions
819
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bun-types - npm Package Compare versions

Comparing version 1.2.3-canary.20250216T140609 to 1.2.3-canary.20250217T140554

2

docs/api/fetch.md

@@ -340,3 +340,3 @@ Bun implements the WHATWG `fetch` standard, with some extensions to meet the needs of server-side JavaScript.

[fetch] > Connection: keep-alive
[fetch] > User-Agent: Bun/1.2.3-canary.20250216T140609
[fetch] > User-Agent: Bun/1.2.3-canary.20250217T140554
[fetch] > Accept: */*

@@ -343,0 +343,0 @@ [fetch] > Host: example.com

@@ -11,8 +11,43 @@ The page primarily documents the Bun-native `Bun.serve` API. Bun also implements [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) and the Node.js [`http`](https://nodejs.org/api/http.html) and [`https`](https://nodejs.org/api/https.html) modules.

Start an HTTP server in Bun with `Bun.serve`.
Use `Bun.serve` to start an HTTP server in Bun.
```ts
Bun.serve({
// `routes` requires Bun v1.2.3+
routes: {
// Static routes
"/api/status": new Response("OK"),
// Dynamic routes
"/users/:id": req => {
return new Response(`Hello User ${req.params.id}!`);
},
// Per-HTTP method handlers
"/api/posts": {
GET: () => new Response("List posts"),
POST: async req => {
const body = await req.json();
return Response.json({ created: true, ...body });
},
},
// Wildcard route for all routes that start with "/api/" and aren't otherwise matched
"/api/*": Response.json({ message: "Not found" }, { status: 404 }),
// Redirect from /blog/hello to /blog/hello/world
"/blog/hello": Response.redirect("/blog/hello/world"),
// Serve a file by buffering it in memory
"/favicon.ico": new Response(await Bun.file("./favicon.ico").bytes(), {
headers: {
"Content-Type": "image/x-icon",
},
}),
},
// (optional) fallback for unmatched routes:
// Required if Bun's version < 1.2.3
fetch(req) {
return new Response("Bun!");
return new Response("Not Found", { status: 404 });
},

@@ -22,27 +57,27 @@ });

### `fetch` request handler
### Routing
The `fetch` handler handles incoming requests. It receives a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) object and returns a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) or `Promise<Response>`.
Routes in `Bun.serve()` receive a `BunRequest` (which extends [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)) and return a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) or `Promise<Response>`. This makes it easier to use the same code for both sending & receiving HTTP requests.
```ts
Bun.serve({
fetch(req) {
const url = new URL(req.url);
if (url.pathname === "/") return new Response("Home page!");
if (url.pathname === "/blog") return new Response("Blog!");
return new Response("404!");
},
});
// Simplified for brevity
interface BunRequest<T extends string> extends Request {
params: Record<T, string>;
}
```
The `fetch` handler supports async/await:
#### Async/await in routes
You can use async/await in route handlers to return a `Promise<Response>`.
```ts
import { sleep, serve } from "bun";
import { sql, serve } from "bun";
serve({
async fetch(req) {
const start = performance.now();
await sleep(10);
const end = performance.now();
return new Response(`Slept for ${end - start}ms`);
port: 3001,
routes: {
"/api/version": async () => {
const [version] = await sql`SELECT version()`;
return Response.json(version);
},
},

@@ -52,21 +87,19 @@ });

Promise-based responses are also supported:
#### Promise in routes
You can also return a `Promise<Response>` from a route handler.
```ts
Bun.serve({
fetch(req) {
// Forward the request to another server.
return fetch("https://example.com");
},
});
```
import { sql, serve } from "bun";
You can also access the `Server` object from the `fetch` handler. It's the second argument passed to the `fetch` function.
```ts
// `server` is passed in as the second argument to `fetch`.
const server = Bun.serve({
fetch(req, server) {
const ip = server.requestIP(req);
return new Response(`Your IP is ${ip}`);
serve({
routes: {
"/api/version": () => {
return new Promise(resolve => {
setTimeout(async () => {
const [version] = await sql`SELECT version()`;
resolve(Response.json(version));
}, 100);
});
},
},

@@ -76,55 +109,54 @@ });

### Static routes
#### Type-safe route parameters
Use the `static` option to serve static `Response` objects by route.
TypeScript parses route parameters when passed as a string literal, so that your editor will show autocomplete when accessing `request.params`.
```ts
// Bun v1.1.27+ required
import type { BunRequest } from "bun";
Bun.serve({
static: {
// health-check endpoint
"/api/health-check": new Response("All good!"),
routes: {
// TypeScript knows the shape of params when passed as a string literal
"/orgs/:orgId/repos/:repoId": req => {
const { orgId, repoId } = req.params;
return Response.json({ orgId, repoId });
},
// redirect from /old-link to /new-link
"/old-link": Response.redirect("/new-link", 301),
// serve static text
"/": new Response("Hello World"),
// serve a file by buffering it in memory
"/index.html": new Response(await Bun.file("./index.html").bytes(), {
headers: {
"Content-Type": "text/html",
},
}),
"/favicon.ico": new Response(await Bun.file("./favicon.ico").bytes(), {
headers: {
"Content-Type": "image/x-icon",
},
}),
// serve JSON
"/api/version.json": Response.json({ version: "1.0.0" }),
"/orgs/:orgId/repos/:repoId/settings": (
// optional: you can explicitly pass a type to BunRequest:
req: BunRequest<"/orgs/:orgId/repos/:repoId/settings">,
) => {
const { orgId, repoId } = req.params;
return Response.json({ orgId, repoId });
},
},
fetch(req) {
return new Response("404!");
},
});
```
Static routes support headers, status code, and other `Response` options.
Percent-encoded route parameter values are automatically decoded. Unicode characters are supported. Invalid unicode is replaced with the unicode replacement character `&0xFFFD;`.
### Static responses
Routes can also be `Response` objects (without the handler function). Bun.serve() optimizes it for zero-allocation dispatch - perfect for health checks, redirects, and fixed content:
```ts
Bun.serve({
static: {
"/api/time": new Response(new Date().toISOString(), {
routes: {
// Health checks
"/health": new Response("OK"),
"/ready": new Response("Ready", {
headers: {
"X-Custom-Header": "Bun!",
// Pass custom headers
"X-Ready": "1",
},
}),
},
fetch(req) {
return new Response("404!");
// Redirects
"/blog": Response.redirect("https://bun.sh/blog"),
// API responses
"/api/config": Response.json({
version: "1.0.0",
env: "production",
}),
},

@@ -134,8 +166,4 @@ });

Static routes can serve Response bodies faster than `fetch` handlers because they don't create `Request` objects, they don't create `AbortSignal`, they don't create additional `Response` objects. The only per-request memory allocation is the TCP/TLS socket data needed for each request.
Static responses do not allocate additional memory after initialization. You can generally expect at least a 15% performance improvement over manually returning a `Response` object.
{% note %}
`static` is experimental
{% /note %}
Static route responses are cached for the lifetime of the server object. To reload static routes, call `server.reload(options)`.

@@ -168,3 +196,3 @@

Reloading static routes only impact the next request. In-flight requests continue to use the old static routes. After in-flight requests to old static routes are finished, the old static routes are freed from memory.
Reloading routes only impact the next request. In-flight requests continue to use the old routes. After in-flight requests to old routes are finished, the old routes are freed from memory.

@@ -189,2 +217,266 @@ To simplify error handling, static routes do not support streaming response bodies from `ReadableStream` or an `AsyncIterator`. Fortunately, you can still buffer the response in memory first:

### Route precedence
Routes are matched in order of specificity:
1. Exact routes (`/users/all`)
2. Parameter routes (`/users/:id`)
3. Wildcard routes (`/users/*`)
4. Global catch-all (`/*`)
```ts
Bun.serve({
routes: {
// Most specific first
"/api/users/me": () => new Response("Current user"),
"/api/users/:id": req => new Response(`User ${req.params.id}`),
"/api/*": () => new Response("API catch-all"),
"/*": () => new Response("Global catch-all"),
},
});
```
### Per-HTTP Method Routes
Route handlers can be specialized by HTTP method:
```ts
Bun.serve({
routes: {
"/api/posts": {
// Different handlers per method
GET: () => new Response("List posts"),
POST: async req => {
const post = await req.json();
return Response.json({ id: crypto.randomUUID(), ...post });
},
PUT: async req => {
const updates = await req.json();
return Response.json({ updated: true, ...updates });
},
DELETE: () => new Response(null, { status: 204 }),
},
},
});
```
You can pass any of the following methods:
| Method | Usecase example |
| --------- | ------------------------------- |
| `GET` | Fetch a resource |
| `HEAD` | Check if a resource exists |
| `OPTIONS` | Get allowed HTTP methods (CORS) |
| `DELETE` | Delete a resource |
| `PATCH` | Update a resource |
| `POST` | Create a resource |
| `PUT` | Update a resource |
When passing a function instead of an object, all methods will be handled by that function:
```ts
const server = Bun.serve({
routes: {
"/api/version": () => Response.json({ version: "1.0.0" }),
},
});
await fetch(new URL("/api/version", server.url));
await fetch(new URL("/api/version", server.url), { method: "PUT" });
// ... etc
```
### Hot Route Reloading
Update routes without server restarts using `server.reload()`:
```ts
const server = Bun.serve({
routes: {
"/api/version": () => Response.json({ version: "1.0.0" }),
},
});
// Deploy new routes without downtime
server.reload({
routes: {
"/api/version": () => Response.json({ version: "2.0.0" }),
},
});
```
### Error Handling
Bun provides structured error handling for routes:
```ts
Bun.serve({
routes: {
// Errors are caught automatically
"/api/risky": () => {
throw new Error("Something went wrong");
},
},
// Global error handler
error(error) {
console.error(error);
return new Response(`Internal Error: ${error.message}`, {
status: 500,
headers: {
"Content-Type": "text/plain",
},
});
},
});
```
### HTML imports
To add a client-side single-page app, you can use an HTML import:
```ts
import myReactSinglePageApp from "./index.html";
Bun.serve({
routes: {
"/": myReactSinglePageApp,
},
});
```
HTML imports don't just serve HTML. It's a full-featured frontend bundler, transpiler, and toolkit built using Bun's [bundler](https://bun.sh/docs/bundler), JavaScript transpiler and CSS parser.
You can use this to build a full-featured frontend with React, TypeScript, Tailwind CSS, and more. Check out [/docs/bundler/fullstack](https://bun.sh/docs/bundler/fullstack) to learn more.
### Practical example: REST API
Here's a basic database-backed REST API using Bun's router with zero dependencies:
{% codetabs %}
```ts#server.ts
import type { Post } from "./types.ts";
import { Database } from "bun:sqlite";
const db = new Database("posts.db");
db.exec(`
CREATE TABLE IF NOT EXISTS posts (
id TEXT PRIMARY KEY,
title TEXT NOT NULL,
content TEXT NOT NULL,
created_at TEXT NOT NULL
)
`);
Bun.serve({
routes: {
// List posts
"/api/posts": {
GET: () => {
const posts = db.query("SELECT * FROM posts").all();
return Response.json(posts);
},
// Create post
POST: async req => {
const post: Omit<Post, "id" | "created_at"> = await req.json();
const id = crypto.randomUUID();
db.query(
`INSERT INTO posts (id, title, content, created_at)
VALUES (?, ?, ?, ?)`,
).run(id, post.title, post.content, new Date().toISOString());
return Response.json({ id, ...post }, { status: 201 });
},
},
// Get post by ID
"/api/posts/:id": req => {
const post = db
.query("SELECT * FROM posts WHERE id = ?")
.get(req.params.id);
if (!post) {
return new Response("Not Found", { status: 404 });
}
return Response.json(post);
},
},
error(error) {
console.error(error);
return new Response("Internal Server Error", { status: 500 });
},
});
```
```ts#types.ts
export interface Post {
id: string;
title: string;
content: string;
created_at: string;
}
```
{% /codetabs %}
### Routing performance
`Bun.serve()`'s router builds on top uWebSocket's [tree-based approach](https://github.com/oven-sh/bun/blob/0d1a00fa0f7830f8ecd99c027fce8096c9d459b6/packages/bun-uws/src/HttpRouter.h#L57-L64) to add [SIMD-accelerated route parameter decoding](https://github.com/oven-sh/bun/blob/jarred/optional-fetch/src/bun.js/bindings/decodeURIComponentSIMD.cpp#L21-L271) and [JavaScriptCore structure caching](https://github.com/oven-sh/bun/blob/jarred/optional-fetch/src/bun.js/bindings/ServerRouteList.cpp#L100-L101) to push the performance limits of what modern hardware allows.
### `fetch` request handler
The `fetch` handler handles incoming requests that weren't matched by any route. It receives a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) object and returns a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) or [`Promise<Response>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
```ts
Bun.serve({
fetch(req) {
const url = new URL(req.url);
if (url.pathname === "/") return new Response("Home page!");
if (url.pathname === "/blog") return new Response("Blog!");
return new Response("404!");
},
});
```
The `fetch` handler supports async/await:
```ts
import { sleep, serve } from "bun";
serve({
async fetch(req) {
const start = performance.now();
await sleep(10);
const end = performance.now();
return new Response(`Slept for ${end - start}ms`);
},
});
```
Promise-based responses are also supported:
```ts
Bun.serve({
fetch(req) {
// Forward the request to another server.
return fetch("https://example.com");
},
});
```
You can also access the `Server` object from the `fetch` handler. It's the second argument passed to the `fetch` function.
```ts
// `server` is passed in as the second argument to `fetch`.
const server = Bun.serve({
fetch(req, server) {
const ip = server.requestIP(req);
return new Response(`Your IP is ${ip}`);
},
});
```
### Changing the `port` and `hostname`

@@ -563,3 +855,3 @@

const server = Bun.serve({
static: {
routes: {
"/api/version": Response.json({ version: "v1" }),

@@ -574,3 +866,3 @@ },

server.reload({
static: {
routes: {
"/api/version": Response.json({ version: "v2" }),

@@ -584,3 +876,3 @@ },

This is useful for development and hot reloading. Only `fetch`, `error`, and `static` handlers can be updated.
This is useful for development and hot reloading. Only `fetch`, `error`, and `routes` can be updated.

@@ -587,0 +879,0 @@ ## Per-Request Controls

@@ -113,3 +113,3 @@ Spawn child processes with `Bun.spawn` or `Bun.spawnSync`.

const text = await new Response(proc.stdout).text();
console.log(text); // => "1.2.3-canary.20250216T140609"
console.log(text); // => "1.2.3-canary.20250217T140554"
```

@@ -116,0 +116,0 @@

@@ -188,7 +188,15 @@ Bun provides native bindings for working with PostgreSQL databases with a modern, Promise-based API. The interface is designed to be simple and performant, using tagged template literals for queries and offering features like connection pooling, transactions, and prepared statements.

You can use the `sql.unsafe` function to execute raw SQL strings. Use this with caution, as it will not escape user input.
You can use the `sql.unsafe` function to execute raw SQL strings. Use this with caution, as it will not escape user input. Executing more than one command per query is allowed if no parameters are used.
```ts
// Multiple commands without parameters
const result = await sql.unsafe(`
SELECT ${userColumns} FROM users;
SELECT ${accountColumns} FROM accounts;
`);
// Using parameters (only one command is allowed)
const result = await sql.unsafe(
"SELECT " + columns + " FROM users WHERE id = " + id,
"SELECT " + dangerous + " FROM users WHERE id = $1",
[id],
);

@@ -455,3 +463,3 @@ ```

By default, Bun's SQL client automatically creates prepared statements for queries where it can be inferred that the query is static. This provides better performance and security. However, you can disable prepared statements by setting `prepare: false` in the connection options:
By default, Bun's SQL client automatically creates named prepared statements for queries where it can be inferred that the query is static. This provides better performance. However, you can change this behavior by setting `prepare: false` in the connection options:

@@ -461,15 +469,15 @@ ```ts

// ... other options ...
prepare: false, // Disable prepared statements
prepare: false, // Disable persisting named prepared statements on the server
});
```
When prepared statements are disabled:
When `prepare: false` is set:
- Queries are executed using simple query protocol
- Each query is sent to the server as a raw SQL string
- Multiple statements can be executed in a single query (using `sql``.simple()`)
- Parameter binding is still safe against SQL injection, but simple queries cannot include parameters
Queries are still executed using the "extended" protocol, but they are executed using [unnamed prepared statements](https://www.postgresql.org/docs/current/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY), an unnamed prepared statement lasts only until the next Parse statement specifying the unnamed statement as destination is issued.
- Parameter binding is still safe against SQL injection
- Each query is parsed and planned from scratch by the server
- Queries will not be [pipelined](https://www.postgresql.org/docs/current/protocol-flow.html#PROTOCOL-FLOW-PIPELINING)
You might want to disable prepared statements when:
You might want to use `prepare: false` when:

@@ -479,2 +487,3 @@ - Using PGBouncer in transaction mode (though since PGBouncer 1.21.0, protocol-level named prepared statements are supported when configured properly)

- Working with dynamic SQL where query plans need to be regenerated frequently
- More than one command per query will not be supported (unless you use `sql``.simple()`)

@@ -481,0 +490,0 @@ Note that disabling prepared statements may impact performance for queries that are executed frequently with different parameters, as the server needs to parse and plan each query from scratch.

@@ -6,9 +6,10 @@ Using `Bun.serve()`'s `routes` option, you can run your frontend and backend in the same app with no extra steps.

```ts
import { sql, serve } from "bun";
import dashboard from "./dashboard.html";
import homepage from "./index.html";
const server = Bun.serve({
// Add HTML imports to `routes` (before Bun v1.2.3, this was called `static`)
const server = serve({
routes: {
// Bundle & route index.html to "/"
// ** HTML imports **
// Bundle & route index.html to "/". This uses HTMLRewriter to scan the HTML for `<script>` and `<link>` tags, run's Bun's JavaScript & CSS bundler on them, transpiles any TypeScript, JSX, and TSX, downlevels CSS with Bun's CSS parser and serves the result.
"/": homepage,

@@ -18,11 +19,18 @@ // Bundle & route dashboard.html to "/dashboard"

// API endpoints:
"/api/users": async req => {
const users = await Bun.sql`SELECT * FROM users`;
return Response.json(users);
// ** API endpoints ** (Bun v1.2.3+ required)
"/api/users": {
async GET(req) {
const users = await sql`SELECT * FROM users`;
return Response.json(users);
},
async POST(req) {
const { name, email } = await req.json();
const [user] =
await sql`INSERT INTO users (name, email) VALUES (${name}, ${email})`;
return Response.json(user);
},
},
"/api/users/:id": async req => {
const { id } = req.params;
const [user] = await Bun.sql`SELECT * FROM users WHERE id = ${id}`;
const [user] = await sql`SELECT * FROM users WHERE id = ${id}`;
return Response.json(user);

@@ -37,7 +45,7 @@ },

// Handle API requests
async fetch(req) {
// Return 404 for unmatched routes
return new Response("Not Found", { status: 404 });
},
// Prior to v1.2.3, the `fetch` option was used to handle all API requests. It is now optional.
// async fetch(req) {
// // Return 404 for unmatched routes
// return new Response("Not Found", { status: 404 });
// },
});

@@ -44,0 +52,0 @@

@@ -10,3 +10,3 @@ Use `bun publish` to publish a package to the npm registry.

## Output
bun publish v1.2.3-canary.20250216T140609 (ca7428e9)
bun publish v1.2.3-canary.20250217T140554 (ca7428e9)

@@ -13,0 +13,0 @@ packed 203B package.json

@@ -12,3 +12,3 @@ ---

◐ Installing dependencies...
bun install v1.2.3-canary.20250216T140609 (16b4bf34)
bun install v1.2.3-canary.20250217T140554 (16b4bf34)
+ @nuxt/devtools@0.8.2

@@ -15,0 +15,0 @@ + nuxt@3.7.0

@@ -19,3 +19,3 @@ ---

"peerDependencies": {
+ "@types/bun": "^1.2.3-canary.20250216T140609"
+ "@types/bun": "^1.2.3-canary.20250217T140554"
}

@@ -32,3 +32,3 @@ }

"peerDependencies": {
"@types/bun": "^1.2.3-canary.20250216T140609"
"@types/bun": "^1.2.3-canary.20250217T140554"
},

@@ -35,0 +35,0 @@ "peerDependenciesMeta": {

@@ -100,3 +100,3 @@ ---

# Update a dependency to a specific version
$ bun update @types/bun@1.2.3-canary.20250216T140609
$ bun update @types/bun@1.2.3-canary.20250217T140554

@@ -103,0 +103,0 @@ # Update all dependencies to the latest versions

@@ -24,3 +24,3 @@ ---

$ bun test
bun test v1.2.3-canary.20250216T140609 (9c68abdb)
bun test v1.2.3-canary.20250217T140554 (9c68abdb)

@@ -51,3 +51,3 @@ test.test.js:

$ bun test test3
bun test v1.2.3-canary.20250216T140609 (9c68abdb)
bun test v1.2.3-canary.20250217T140554 (9c68abdb)

@@ -90,3 +90,3 @@ test3.test.js:

$ bun test -t add
bun test v1.2.3-canary.20250216T140609 (9c68abdb)
bun test v1.2.3-canary.20250217T140554 (9c68abdb)

@@ -93,0 +93,0 @@ test.test.js:

@@ -21,3 +21,3 @@ ---

$ bun test test/snap
bun test v1.2.3-canary.20250216T140609 (9c68abdb)
bun test v1.2.3-canary.20250217T140554 (9c68abdb)

@@ -65,3 +65,3 @@ test/snap.test.ts:

$ bun test
bun test v1.2.3-canary.20250216T140609 (9c68abdb)
bun test v1.2.3-canary.20250217T140554 (9c68abdb)

@@ -83,3 +83,3 @@ test/snap.test.ts:

$ bun test --update-snapshots
bun test v1.2.3-canary.20250216T140609 (9c68abdb)
bun test v1.2.3-canary.20250217T140554 (9c68abdb)

@@ -86,0 +86,0 @@ test/snap.test.ts:

@@ -32,3 +32,3 @@ ---

$ bun test --update-snapshots
bun test v1.2.3-canary.20250216T140609 (9c68abdb)
bun test v1.2.3-canary.20250217T140554 (9c68abdb)

@@ -35,0 +35,0 @@ test/snap.test.ts:

@@ -8,3 +8,3 @@ ---

```ts#index.ts
Bun.version; // => "1.2.3-canary.20250216T140609"
Bun.version; // => "1.2.3-canary.20250217T140554"
```

@@ -11,0 +11,0 @@

@@ -17,3 +17,3 @@ Bun ships as a single executable with no dependencies that can be installed a few different ways.

# to install a specific version
$ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.3-canary.20250216T140609"
$ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.3-canary.20250217T140554"
```

@@ -192,6 +192,6 @@

To install a specific version of Bun, you can pass the git tag of the version you want to install to the install script, such as `bun-v1.2.0` or `bun-v1.2.3-canary.20250216T140609`.
To install a specific version of Bun, you can pass the git tag of the version you want to install to the install script, such as `bun-v1.2.0` or `bun-v1.2.3-canary.20250217T140554`.
```sh
$ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.3-canary.20250216T140609"
$ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.3-canary.20250217T140554"
```

@@ -205,3 +205,3 @@

# PowerShell:
$ iex "& {$(irm https://bun.sh/install.ps1)} -Version 1.2.3-canary.20250216T140609"
$ iex "& {$(irm https://bun.sh/install.ps1)} -Version 1.2.3-canary.20250217T140554"
```

@@ -208,0 +208,0 @@

@@ -127,7 +127,7 @@ ---

```sh
[fetch] $ curl --http1.1 "https://example.com/" -X POST -H "content-type: application/json" -H "Connection: keep-alive" -H "User-Agent: Bun/1.2.3-canary.20250216T140609" -H "Accept: */*" -H "Host: example.com" -H "Accept-Encoding: gzip, deflate, br" --compressed -H "Content-Length: 13" --data-raw "{\"foo\":\"bar\"}"
[fetch] $ curl --http1.1 "https://example.com/" -X POST -H "content-type: application/json" -H "Connection: keep-alive" -H "User-Agent: Bun/1.2.3-canary.20250217T140554" -H "Accept: */*" -H "Host: example.com" -H "Accept-Encoding: gzip, deflate, br" --compressed -H "Content-Length: 13" --data-raw "{\"foo\":\"bar\"}"
[fetch] > HTTP/1.1 POST https://example.com/
[fetch] > content-type: application/json
[fetch] > Connection: keep-alive
[fetch] > User-Agent: Bun/1.2.3-canary.20250216T140609
[fetch] > User-Agent: Bun/1.2.3-canary.20250217T140554
[fetch] > Accept: */*

@@ -174,3 +174,3 @@ [fetch] > Host: example.com

[fetch] > Connection: keep-alive
[fetch] > User-Agent: Bun/1.2.3-canary.20250216T140609
[fetch] > User-Agent: Bun/1.2.3-canary.20250217T140554
[fetch] > Accept: */*

@@ -177,0 +177,0 @@ [fetch] > Host: example.com

@@ -58,3 +58,3 @@ Bun's test runner plays well with existing component and DOM testing libraries, including React Testing Library and [`happy-dom`](https://github.com/capricorn86/happy-dom).

$ bun test
bun test v1.2.3-canary.20250216T140609
bun test v1.2.3-canary.20250217T140554

@@ -61,0 +61,0 @@ dom.test.ts:

{
"version": "1.2.3-canary.20250216T140609",
"version": "1.2.3-canary.20250217T140554",
"name": "bun-types",

@@ -4,0 +4,0 @@ "license": "MIT",

Sorry, the diff of this file is too big to display

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