{"id":13446998,"url":"https://github.com/mikeal/bent","last_synced_at":"2025-10-06T13:47:00.564Z","repository":{"id":52295259,"uuid":"109886801","full_name":"mikeal/bent","owner":"mikeal","description":"Functional JS HTTP client (Node.js \u0026 Fetch) w/ async await","archived":false,"fork":false,"pushed_at":"2022-12-20T00:43:26.000Z","size":111,"stargazers_count":2197,"open_issues_count":29,"forks_count":83,"subscribers_count":33,"default_branch":"master","last_synced_at":"2025-09-12T16:16:00.969Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mikeal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-07T20:24:52.000Z","updated_at":"2025-08-17T02:59:00.000Z","dependencies_parsed_at":"2023-01-29T23:15:53.966Z","dependency_job_id":null,"html_url":"https://github.com/mikeal/bent","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/mikeal/bent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeal%2Fbent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeal%2Fbent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeal%2Fbent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeal%2Fbent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikeal","download_url":"https://codeload.github.com/mikeal/bent/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikeal%2Fbent/sbom","scorecard":{"id":645154,"data":{"date":"2025-08-11","repo":{"name":"github.com/mikeal/bent","commit":"b82461d3e24d4c9b19e51575fc8243bbcf862be0"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/mikeals-workflow.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":3,"reason":"Found 11/30 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/mikeals-workflow.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/mikeal/bent/mikeals-workflow.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/mikeals-workflow.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/mikeal/bent/mikeals-workflow.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/mikeals-workflow.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/mikeal/bent/mikeals-workflow.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/mikeals-workflow.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/mikeal/bent/mikeals-workflow.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/mikeals-workflow.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/mikeal/bent/mikeals-workflow.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/mikeals-workflow.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/mikeal/bent/mikeals-workflow.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/mikeals-workflow.yml:25","Warn: npmCommand not pinned by hash: .github/workflows/mikeals-workflow.yml:43","Info:   0 out of   5 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   2 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 14 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T11:57:38.212Z","repository_id":52295259,"created_at":"2025-08-21T11:57:38.212Z","updated_at":"2025-08-21T11:57:38.212Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278621842,"owners_count":26017253,"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-10-06T02:00:05.630Z","response_time":65,"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":"2024-07-31T05:01:05.416Z","updated_at":"2025-10-06T13:47:00.544Z","avatar_url":"https://github.com/mikeal.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","others","📦 Legacy \u0026 Inactive Projects"],"sub_categories":[],"readme":"# bent\n\n![2377](https://img.shields.io/badge/compiled%20bundle-2k-brightgreen) ![1106](https://img.shields.io/badge/gzipped%20bundle-1k-brightgreen)\n\nFunctional HTTP client for Node.js and Browsers with async/await.\n\n*Incredibly small browser version built on fetch with no external dependencies or polyfills.*\n\n## Usage\n\n```javascript\nconst bent = require('bent')\n\nconst getJSON = bent('json')\nconst getBuffer = bent('buffer')\n\nlet obj = await getJSON('http://site.com/json.api')\nlet buffer = await getBuffer('http://site.com/image.png')\n```\n\nAs you can see, bent is a function that returns an async function.\n\nBent takes options which constrain what is accepted by the client.\nAny response that falls outside the constraints will generate an error.\n\nYou can provide these options in any order, and Bent will figure out which option is which by inspecting the option's type and content.\n```javascript\nconst post = bent('http://localhost:3000/', 'POST', 'json', 200);\nconst response = await post('cars/new', {name: 'bmw', wheels: 4});\n```\n\nIf you don't set a response encoding (`'json'`, `'string'` or `'buffer'`)\nthen the *native* response object will be returned after the statusCode check.\n\nIn Node.js, we also add decoding methods that match the Fetch API (`.json()`,\n`.text()` and `.arrayBuffer()`).\n\n```javascript\nconst bent = require('bent')\n\nconst getStream = bent('http://site.com')\n\nlet stream = await getStream('/json.api')\n// status code\nstream.status // 200\nstream.statusCode // 200\n// optionally decode\nconst obj = await stream.json()\n// or\nconst str = await stream.text()\n```\n\nThe following options are available.\n\n* **HTTP Method**: `'GET'`, `'PUT'`, or any other ALLCAPS string will be\n  used to set the HTTP method. Defaults to `'GET'`.\n* **Response Format**: Available formats are `'string'`, `'buffer'`, and\n  `'json'`. By default, the response object/stream will be returned instead\n  of a decoded response. *Browser returns `ArrayBuffer` instead of `Buffer`.*\n* **Status Codes**: Any number will be considered an acceptable status code.\n  By default, `200` is the only acceptable status code. When any status codes\n  are provided, `200` must be included explicitly in order to be acceptable.\n* **Headers**: An object can be passed to set request headers.\n* **Base URL**: Any string that begins with 'https:' or 'http:' is\n  considered the Base URL. Subsequent queries need only pass the remaining\n  URL string.\n\nThe returned async function is used for subsequent requests.\n\nWhen working with Binary this library uses different types in the browser and Node.js. In Node.js all binary must be done\nusing the `Buffer` type. In the browser you can use ArrayBuffer or any ArrayBuffer view type (UInt8Array, etc).\n\n### `async request(url[, body=null, headers={}])`\n\n* **url**: Fully qualified URL to the remote resource, or in the case that a\n  base URL is passed the remaining URL string.\n* **body**: Request body. Can be a string, a stream (node.js), a buffer (node.js) (see note below),\n  an ArrayBuffer (browser), or a JSON object.\n* **headers**: An object of any headers you need to set for just this request.\n\n```javascript\nconst bent = require('bent')\n\nconst put = bent('PUT', 201)\nawait put('http://site.com/upload', Buffer.from('test'))\n```\n\nOr\n\n\n```javascript\nconst bent = require('bent')\n\nconst put = bent('PUT', 201, 'http://site.com')\nawait put('/upload', Buffer.from('test'))\n```\n\n**NOTE:** If the `body` is passed as an `object`, it will be treated\nas JSON, stringified and the `Content-Type` will be set to `application/json`\nunless already set.  A common requirement is to POST using `form-urlencoded`.\nThis will require you to set the `Content-Type` header to\n`application/x-www-form-urlencoded` and to encode the body yourself,\nperhaps using\n[form-urlencoded](https://www.npmjs.com/package/form-urlencoded).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikeal%2Fbent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikeal%2Fbent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikeal%2Fbent/lists"}