Ejemplo
minipass-fetch 4.0.1: fetch
Muestra verificada para npm minipass-fetch 4.0.1: fetch. El contrato se ejecutó en node 22 · linux debian/x64 · docker y pasó.
sha256:d75bb610eb8297bbfc135743c5cb1093dc541d824e49f3493f2d22745d49a560
Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido.
Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas.
MIT-0
Evidencia de ejecución
El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.
- Base de evidencia
- Contrato firmado aprobado
- Recibos de verificación
- 1
- Claves de firma que lo compilaron
- 1
Entorno declarado
node linux 24 · ubuntu · glibc 2.39 x64 node npm
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-10-18 |
Caso
HOW- Objetivo
- verify fetch in pkg:npm/minipass-fetch@4.0.1
- Paquetes
- Símbolos
-
- fetch
- Entorno
- node
- Creado
- 2026-10-18T00:27:51Z
Contrato
- fetch resolves plain and base64 data: URIs into Response instances with decoded body and Content-Type header, and rejects malformed data: URIs with FetchError (type 'system')
- fetch.isRedirect returns true for HTTP redirect status codes (301, 302, 303, 307, 308) and false for non-redirect status codes
- fetch sends POST requests with custom headers and body, automatically decompresses gzip-encoded responses by default, and returns raw compressed bytes when compress: false
- fetch follows 302 redirects by converting POST to GET, preserves 302 with resolved Location on redirect: 'manual', rejects with FetchError (type 'no-redirect') on redirect: 'error', and enforces the follow redirect limit (type 'max-redirect')
- fetch rejects with AbortError when passed an aborted AbortSignal
Archivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Código fuente
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify fetch in pkg:npm/minipass-fetch@4.0.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/minipass-fetch@4.0.1
Demonstrate these symbols/APIs:
- fetch
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:65237b2dc257df0b4f287fd11a27f6b0ff1246f61e5330cc5dcad5f6b392b665","contract":["fetch resolves plain and base64 data: URIs into Response instances with decoded body and Content-Type header, and rejects malformed data: URIs with FetchError (type 'system')","fetch.isRedirect returns true for HTTP redirect status codes (301, 302, 303, 307, 308) and false for non-redirect status codes","fetch sends POST requests with custom headers and body, automatically decompresses gzip-encoded responses by default, and returns raw compressed bytes when compress: false","fetch follows 302 redirects by converting POST to GET, preserves 302 with resolved Location on redirect: 'manual', rejects with FetchError (type 'no-redirect') on redirect: 'error', and enforces the follow redirect limit (type 'max-redirect')","fetch rejects with AbortError when passed an aborted AbortSignal"],"goal":"verify fetch in pkg:npm/minipass-fetch@4.0.1","kind":"HOW","packages":["pkg:npm/minipass-fetch@4.0.1"],"schemaVersion":1,"symbols":["fetch"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","libc":"glibc","libcVersion":"2.39","moduleSystem":"esm","os":"linux","osVersionBucket":"24","packageManager":"npm","runtime":"node","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/minipass-fetch@4.0.1"],"schemaVersion":1,"subject":"pkg:npm/minipass-fetch@4.0.1","symbols":["fetch"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-minipass-fetch",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-minipass-fetch",
"version": "1.0.0",
"dependencies": {
"minipass-fetch": "4.0.1"
}
},
"node_modules/encoding": {
"version": "0.1.13",
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
"integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",
"license": "MIT",
"optional": true,
"dependencies": {
"iconv-lite": "^0.6.2"
}
},
"node_modules/iconv-lite": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
"license": "MIT",
"optional": true,
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3.0.0"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/minipass": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz",
"integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==",
"license": "BlueOak-1.0.0",
"engines": {
"node": ">=16 || 14 >=14.17"
}
},
"node_modules/minipass-fetch": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-4.0.1.tgz",
"integrity": "sha512-j7U11C5HXigVuutxebFadoYBbd7VSdZWggSe64NVdvWNBqGAiXPL2QVCehjmw7lY1oF9gOllYbORh+hiNgfPgQ==",
"license": "MIT",
"dependencies": {
"minipass": "^7.0.3",
"minipass-sized": "^1.0.3",
"minizlib": "^3.0.1"
},
"engines": {
"node": "^18.17.0 || >=20.5.0"
},
"optionalDependencies": {
"encoding": "^0.1.13"
}
},
"node_modules/minipass-sized": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz",
"integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==",
"license": "ISC",
"dependencies": {
"minipass": "^3.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/minipass-sized/node_modules/minipass": {
"version": "3.3.6",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
"integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
"license": "ISC",
"dependencies": {
"yallist": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/minizlib": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.1.0.tgz",
"integrity": "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==",
"license": "MIT",
"dependencies": {
"minipass": "^7.1.2"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"license": "MIT",
"optional": true
},
"node_modules/yallist": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
"license": "ISC"
}
}
}
{
"name": "sample-minipass-fetch",
"version": "1.0.0",
"private": true,
"type": "module",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"minipass-fetch": "4.0.1"
}
}
{
"schemaVersion": 1,
"goal": "verify fetch in pkg:npm/minipass-fetch@4.0.1",
"kind": "HOW",
"packages": [
"pkg:npm/minipass-fetch@4.0.1"
],
"symbols": [
"fetch"
]
}
import assert from 'node:assert/strict'
import http from 'node:http'
import zlib from 'node:zlib'
import fetch from 'minipass-fetch'
// 1. Verify data: URI resolution (plain text, base64, and invalid data: URI)
{
const plainRes = await fetch('data:text/plain;charset=utf-8,Hello%20World')
assert.equal(plainRes.status, 200)
assert.equal(plainRes.headers.get('content-type'), 'text/plain;charset=utf-8')
assert.equal(await plainRes.text(), 'Hello World')
const payload = JSON.stringify({ ok: true, count: 42 })
const b64 = Buffer.from(payload, 'utf8').toString('base64')
const b64Res = await fetch(`data:application/json;base64,${b64}`)
assert.equal(b64Res.headers.get('content-type'), 'application/json')
assert.deepEqual(await b64Res.json(), { ok: true, count: 42 })
await assert.rejects(
() => fetch('data:text/plain-missing-comma'),
err => err instanceof fetch.FetchError && err.type === 'system'
)
}
// 2. Verify fetch.isRedirect helper
{
for (const code of [301, 302, 303, 307, 308]) {
assert.equal(fetch.isRedirect(code), true)
}
for (const code of [200, 204, 300, 304, 400, 500]) {
assert.equal(fetch.isRedirect(code), false)
}
}
// 3. Verify HTTP requests, gzip decompression, redirects, and abort handling via local server
const server = http.createServer((req, res) => {
if (req.url === '/echo') {
const chunks = []
req.on('data', c => chunks.push(c))
req.on('end', () => {
const body = Buffer.concat(chunks).toString('utf8')
res.writeHead(200, { 'Content-Type': 'application/json' })
res.end(JSON.stringify({
method: req.method,
customHeader: req.headers['x-test-header'] || null,
body,
}))
})
return
}
if (req.url === '/gzip') {
const compressed = zlib.gzipSync(Buffer.from('compressed-payload', 'utf8'))
res.writeHead(200, {
'Content-Type': 'text/plain',
'Content-Encoding': 'gzip',
})
res.end(compressed)
return
}
if (req.url === '/redirect-302') {
res.writeHead(302, { Location: '/echo' })
res.end()
return
}
if (req.url === '/redirect-loop') {
res.writeHead(302, { Location: '/redirect-loop' })
res.end()
return
}
res.writeHead(404)
res.end('not found')
})
await new Promise(resolve => server.listen(0, '127.0.0.1', resolve))
const { port } = server.address()
const baseUrl = `http://localhost:${port}`
try {
// POST request with custom headers and JSON response
const postRes = await fetch(`${baseUrl}/echo`, {
method: 'POST',
headers: { 'x-test-header': 'verified' },
body: 'hello-post',
})
assert.equal(postRes.status, 200)
assert.deepEqual(await postRes.json(), {
method: 'POST',
customHeader: 'verified',
body: 'hello-post',
})
// Automatic gzip decompression vs compress: false
const gzipDecoded = await fetch(`${baseUrl}/gzip`)
assert.equal(await gzipDecoded.text(), 'compressed-payload')
const gzipRaw = await fetch(`${baseUrl}/gzip`, { compress: false })
const rawBuf = await gzipRaw.buffer()
assert.equal(zlib.gunzipSync(rawBuf).toString('utf8'), 'compressed-payload')
// Redirect handling: follow (POST -> GET on 302), manual, error, and follow limit
const followed = await fetch(`${baseUrl}/redirect-302`, {
method: 'POST',
body: 'dropped-on-302',
})
assert.equal(followed.status, 200)
assert.deepEqual(await followed.json(), {
method: 'GET',
customHeader: null,
body: '',
})
const manual = await fetch(`${baseUrl}/redirect-302`, { redirect: 'manual' })
assert.equal(manual.status, 302)
assert.equal(manual.headers.get('location'), `${baseUrl}/echo`)
await assert.rejects(
() => fetch(`${baseUrl}/redirect-302`, { redirect: 'error' }),
err => err instanceof fetch.FetchError && err.type === 'no-redirect'
)
await assert.rejects(
() => fetch(`${baseUrl}/redirect-loop`, { follow: 2 }),
err => err instanceof fetch.FetchError && err.type === 'max-redirect'
)
// AbortSignal cancellation
const ac = new AbortController()
ac.abort()
await assert.rejects(
() => fetch(`${baseUrl}/echo`, { signal: ac.signal }),
err => err instanceof fetch.AbortError && err.name === 'AbortError'
)
} finally {
await new Promise(resolve => server.close(resolve))
}
Seeder de origen
anónimo