{"id":34687925,"url":"https://github.com/httpland/response-utils","last_synced_at":"2026-06-01T07:01:40.841Z","repository":{"id":176564902,"uuid":"636499012","full_name":"httpland/response-utils","owner":"httpland","description":"Response utility collection","archived":false,"fork":false,"pushed_at":"2023-05-09T01:12:10.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-06T13:56:39.666Z","etag":null,"topics":["collection","fetch-api","http","response","utilities","utility"],"latest_commit_sha":null,"homepage":"https://deno.land/x/response_utils","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/httpland.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-05-05T01:42:42.000Z","updated_at":"2023-05-08T09:49:38.000Z","dependencies_parsed_at":"2023-12-12T15:06:12.418Z","dependency_job_id":"363179cc-d259-42ec-a13e-7b6556f9669c","html_url":"https://github.com/httpland/response-utils","commit_stats":{"total_commits":11,"total_committers":2,"mean_commits":5.5,"dds":0.2727272727272727,"last_synced_commit":"8692c49c4d0b66608938414d28158f01ed4c272e"},"previous_names":["httpland/response-utils"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/httpland/response-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/httpland%2Fresponse-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/httpland%2Fresponse-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/httpland%2Fresponse-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/httpland%2Fresponse-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/httpland","download_url":"https://codeload.github.com/httpland/response-utils/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/httpland%2Fresponse-utils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33763655,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-01T02:00:06.963Z","response_time":115,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["collection","fetch-api","http","response","utilities","utility"],"created_at":"2025-12-24T21:55:34.819Z","updated_at":"2026-06-01T07:01:40.826Z","avatar_url":"https://github.com/httpland.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# response-utils\n\n[![deno land](http://img.shields.io/badge/available%20on-deno.land/x-lightgrey.svg?logo=deno)](https://deno.land/x/response_utils)\n[![GitHub release (latest by date)](https://img.shields.io/github/v/release/httpland/response-utils)](https://github.com/httpland/response-utils/releases)\n[![codecov](https://codecov.io/github/httpland/response-utils/branch/main/graph/badge.svg)](https://codecov.io/gh/httpland/response-utils)\n[![GitHub](https://img.shields.io/github/license/httpland/response-utils)](https://github.com/httpland/response-utils/blob/main/LICENSE)\n\n[![test](https://github.com/httpland/response-utils/actions/workflows/test.yaml/badge.svg)](https://github.com/httpland/response-utils/actions/workflows/test.yaml)\n[![NPM](https://nodei.co/npm/@httpland/response-utils.png?mini=true)](https://nodei.co/npm/@httpland/response-utils/)\n\nResponse utility collection.\n\n## createResponse\n\nCreate a new `Response`\n\nIf you create a new `Response` from an existing `Response`, any options you set\nin an options argument for the new response replace any corresponding options\nset in the original `Response`.\n\n```ts\nimport { createResponse } from \"https://deno.land/x/response_utils@$VERSION/create.ts\";\nimport { assertEquals } from \"https://deno.land/std/testing/asserts.ts\";\n\ndeclare const init: Response;\nconst response = createResponse(init, { status: 201 });\n\nassertEquals(response.status, 201);\n```\n\n## equalsResponse\n\nCheck two `Response` fields equality.\n\n```ts\nimport { equalsResponse } from \"https://deno.land/x/response_utils@$VERSION/equal.ts\";\nimport { assert } from \"https://deno.land/std/testing/asserts.ts\";\n\nassert(\n  equalsResponse(\n    new Response(null, { status: 204, headers: { \"content-length\": \"0\" } }),\n    new Response(null, { status: 204, headers: { \"content-length\": \"0\" } }),\n  ),\n);\n```\n\nIf you also want to check the equivalence of the body, set the mode to strict.\n\n```ts\nimport { equalsResponse } from \"https://deno.land/x/response_utils@$VERSION/equal.ts\";\nimport { assert } from \"https://deno.land/std/testing/asserts.ts\";\n\nassert(\n  await equalsResponse(\n    new Response(\"test1\", { status: 200, headers: { \"content-length\": \"5\" } }),\n    new Response(\"test2\", { status: 200, headers: { \"content-length\": \"5\" } }),\n    true,\n  ),\n);\n```\n\n### Throwing error\n\nIn strict mode, if response body has already been read.\n\n```ts\nimport { equalsResponse } from \"https://deno.land/x/response_utils@$VERSION/equal.ts\";\nimport { assert, assertThrows } from \"https://deno.land/std/testing/asserts.ts\";\n\nconst response = new Response(\"\");\nawait response.text();\n\nassert(response.bodyUsed);\nassertThrows(() =\u003e equalsResponse(response, response, true));\n```\n\n## isResponse\n\nWhether the input is `Response` or not.\n\n```ts\nimport { isResponse } from \"https://deno.land/x/response_utils@$VERSION/is.ts\";\nimport { assert, assertFalse } from \"https://deno.land/std/testing/asserts.ts\";\n\nassert(isResponse(new Response()));\nassertFalse(isResponse({}));\nassertFalse(isResponse(null));\n```\n\n## withHeader\n\nReturn an instance with the provided `Response` replacing the specified header.\nThere are no side effects on the original `Response`.\n\n```ts\nimport { withHeader } from \"https://deno.land/x/response_utils@$VERSION/with_header.ts\";\nimport { assert } from \"https://deno.land/std/testing/asserts.ts\";\n\ndeclare const init: Response;\ndeclare const fieldName: string;\ndeclare const fieldValue: string;\n\nconst response = withHeader(init, fieldName, fieldValue);\n\nassert(response.headers.get(fieldName), fieldValue);\nassert(init !== response);\n```\n\n## API\n\nAll APIs can be found in the [deno doc](https://deno.land/x/response_utils?doc).\n\n## License\n\nCopyright © 2023-present [httpland](https://github.com/httpland).\n\nReleased under the [MIT](./LICENSE) license\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhttpland%2Fresponse-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhttpland%2Fresponse-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhttpland%2Fresponse-utils/lists"}