CodeSampleX

샘플

minipass-fetch 4.0.1: Request

검증된 샘플 — npm minipass-fetch 4.0.1: Request. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: new Request(input, init) normalizes URL strings and…

sha256:909a8ad94c2a3a76a8e1cb289663e3875fc6f35cd1f66d7f758040ecbcb2e084

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. MIT-0

실행 증거

선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.

증거 기준
서명된 컨트랙트 통과
검증 영수증
1
빌드한 서명 키
1
선언된 환경 node linux 24 · ubuntu · glibc 2.39 x64 node npm

검증 실행 환경

환경 컨트랙트 단계 실행일
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

케이스

HOW
목표
verify Request in pkg:npm/minipass-fetch@4.0.1
패키지
심벌
  • Request
환경
node
생성일
2026-10-18T00:18:53Z

컨트랙트

  1. new Request(input, init) normalizes URL strings and URL instances, uppercases standard HTTP methods, and applies default options (method 'GET', redirect 'follow', compress true, follow 20)
  2. Request attaches normalized Headers and exposes body consumers (json(), text()) while clone() duplicates the Request so both original and cloned bodies can be consumed independently
  3. new Request(existingRequest, init) inherits method, url, and redirect settings from the source Request while allowing headers and body overrides
  4. new Request throws TypeError when a body is supplied with GET or HEAD

파일

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.mjs

소스 아티팩트 내려받기 (tar.gz)

소스

PROMPT.md
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 Request 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:
  - Request

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.
csx.json
{"case":{"caseId":"case:sha256:6e76ca4f77b37bf866ac59ad340b15e7ee2c94b9b55798fc84e4e2b9dd0a87dd","contract":["new Request(input, init) normalizes URL strings and URL instances, uppercases standard HTTP methods, and applies default options (method 'GET', redirect 'follow', compress true, follow 20)","Request attaches normalized Headers and exposes body consumers (json(), text()) while clone() duplicates the Request so both original and cloned bodies can be consumed independently","new Request(existingRequest, init) inherits method, url, and redirect settings from the source Request while allowing headers and body overrides","new Request throws TypeError when a body is supplied with GET or HEAD"],"goal":"verify Request in pkg:npm/minipass-fetch@4.0.1","kind":"HOW","packages":["pkg:npm/minipass-fetch@4.0.1"],"schemaVersion":1,"symbols":["Request"]},"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":["Request"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "minipass-fetch-request-sample",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "minipass-fetch-request-sample",
      "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"
    }
  }
}
package.json
{
  "name": "minipass-fetch-request-sample",
  "version": "1.0.0",
  "private": true,
  "type": "module",
  "scripts": {
    "test": "node test/contract.mjs"
  },
  "dependencies": {
    "minipass-fetch": "4.0.1"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify Request in pkg:npm/minipass-fetch@4.0.1",
  "kind": "HOW",
  "packages": [
    "pkg:npm/minipass-fetch@4.0.1"
  ],
  "symbols": [
    "Request"
  ]
}
test/contract.mjs
import assert from 'node:assert/strict'
import fetch from 'minipass-fetch'

const { Request, Headers } = fetch

// 1. Default construction from URL string and URL object
const reqFromStr = new Request('http://example.com/resource')
assert.equal(reqFromStr.method, 'GET')
assert.equal(reqFromStr.url, 'http://example.com/resource')
assert.equal(reqFromStr.redirect, 'follow')
assert.equal(reqFromStr.compress, true)
assert.equal(reqFromStr.follow, 20)
assert.equal(reqFromStr.counter, 0)
assert.ok(reqFromStr.headers instanceof Headers)

const reqFromUrl = new Request(new URL('http://example.com/search?q=1'))
assert.equal(reqFromUrl.url, 'http://example.com/search?q=1')

// 2. Method normalization, headers, body consumption, and options
const reqPost = new Request('http://example.com/items', {
  method: 'post',
  headers: { 'Content-Type': 'application/json', 'X-Item': 'alpha' },
  body: JSON.stringify({ id: 10, active: true }),
  redirect: 'manual',
  follow: 5,
  compress: false,
})
assert.equal(reqPost.method, 'POST')
assert.equal(reqPost.headers.get('content-type'), 'application/json')
assert.equal(reqPost.headers.get('x-item'), 'alpha')
assert.equal(reqPost.redirect, 'manual')
assert.equal(reqPost.follow, 5)
assert.equal(reqPost.compress, false)

// 3. Cloning a Request before consuming its body allows independent consumption
const clonedPost = reqPost.clone()
assert.equal(clonedPost.method, 'POST')
assert.equal(clonedPost.url, 'http://example.com/items')
assert.equal(clonedPost.headers.get('x-item'), 'alpha')
assert.deepEqual(await reqPost.json(), { id: 10, active: true })
assert.equal(await clonedPost.text(), '{"id":10,"active":true}')

// 4. Constructing a Request from an existing Request with overrides
const baseReq = new Request('http://example.com/v1', {
  method: 'PUT',
  headers: { 'X-Base': 'yes', 'X-Override': 'old' },
  body: 'payload-v1',
  redirect: 'error',
})
const derivedReq = new Request(baseReq, {
  headers: { 'X-Override': 'new' },
  body: 'payload-v2',
})
assert.equal(derivedReq.method, 'PUT')
assert.equal(derivedReq.url, 'http://example.com/v1')
assert.equal(derivedReq.redirect, 'error')
assert.equal(derivedReq.headers.get('x-override'), 'new')
assert.equal(await derivedReq.text(), 'payload-v2')

// 5. Rejects GET/HEAD requests with a body
assert.throws(
  () => new Request('http://example.com/no-body', { method: 'GET', body: 'not-allowed' }),
  TypeError
)
assert.throws(
  () => new Request('http://example.com/no-body', { method: 'HEAD', body: 'not-allowed' }),
  TypeError
)

오리진 시더

익명