{"id":26569858,"url":"https://github.com/checkernetwork/assert-ok-response","last_synced_at":"2025-08-21T10:11:21.340Z","repository":{"id":282895015,"uuid":"950011230","full_name":"CheckerNetwork/assert-ok-response","owner":"CheckerNetwork","description":"A tiny helper to assert that response from `fetch()` is ok","archived":false,"fork":false,"pushed_at":"2025-08-11T12:04:37.000Z","size":338,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-11T12:33:40.541Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CheckerNetwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-17T13:46:35.000Z","updated_at":"2025-08-11T10:59:54.000Z","dependencies_parsed_at":"2025-05-06T08:34:40.789Z","dependency_job_id":"8e87ebad-32c2-4b14-abf6-91e0947e29d2","html_url":"https://github.com/CheckerNetwork/assert-ok-response","commit_stats":null,"previous_names":["checkernetwork/assert-ok-response"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/CheckerNetwork/assert-ok-response","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CheckerNetwork%2Fassert-ok-response","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CheckerNetwork%2Fassert-ok-response/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CheckerNetwork%2Fassert-ok-response/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CheckerNetwork%2Fassert-ok-response/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CheckerNetwork","download_url":"https://codeload.github.com/CheckerNetwork/assert-ok-response/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CheckerNetwork%2Fassert-ok-response/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271462071,"owners_count":24763857,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"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":[],"created_at":"2025-03-22T21:39:51.116Z","updated_at":"2025-08-21T10:11:21.334Z","avatar_url":"https://github.com/CheckerNetwork.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# assert-ok-response\n\nA tiny helper to assert that response from `fetch()` is ok.\n\n## Usage\n\n```js\nimport { assertOkResponse } from 'assert-ok-response'\n\nconst response = await fetch('https://example.com/not-found')\nawait assertOkResponse(response)\n//\n// Throws:\n//\n//  const err = new Error(`${errorMsg ?? `Cannot fetch ${res.url}`} (${res.status}): ${body}`)\n//                ^\n//\n//  Error: Cannot fetch https://example.com/not-found (404): \u003c!doctype html\u003e\n//  [...]\n//  at assertOkResponse (file:///Users/bajtos/src/assert-ok-response/index.js:15:15)\n//  at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n//  at async file:///Users/bajtos/src/assert-ok-response/x.js:4:1 {\n//    statusCode: 404,\n//    serverMessage: '\u003c!doctype html\u003e\\n' +\n//  [...]\n```\n\nError properties:\n\n- `statusCode` (number) - The HTTP status code of the response.\n- `serverMessage` (string) - The response body returned by the server.\n\n## Development\n\n- `npm test` to run the tests.\n- `npm run lint:fix` to fix linting issues.\n- `npx np` to publish a new version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheckernetwork%2Fassert-ok-response","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheckernetwork%2Fassert-ok-response","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheckernetwork%2Fassert-ok-response/lists"}