{"id":16488275,"url":"https://github.com/lrlna/http2-request","last_synced_at":"2025-08-11T06:09:56.113Z","repository":{"id":45064584,"uuid":"129769414","full_name":"lrlna/http2-request","owner":"lrlna","description":"super smol http2 request 📦","archived":false,"fork":false,"pushed_at":"2022-01-11T14:55:14.000Z","size":79,"stargazers_count":50,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-13T12:45:49.651Z","etag":null,"topics":["http2","http2-client","request"],"latest_commit_sha":null,"homepage":"","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/lrlna.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":null,"security":null,"support":null}},"created_at":"2018-04-16T15:56:17.000Z","updated_at":"2025-03-18T11:58:25.000Z","dependencies_parsed_at":"2022-09-10T08:00:09.526Z","dependency_job_id":null,"html_url":"https://github.com/lrlna/http2-request","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/lrlna/http2-request","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lrlna%2Fhttp2-request","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lrlna%2Fhttp2-request/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lrlna%2Fhttp2-request/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lrlna%2Fhttp2-request/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lrlna","download_url":"https://codeload.github.com/lrlna/http2-request/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lrlna%2Fhttp2-request/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269838444,"owners_count":24483200,"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-11T02:00:10.019Z","response_time":75,"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":["http2","http2-client","request"],"created_at":"2024-10-11T13:37:36.860Z","updated_at":"2025-08-11T06:09:55.998Z","avatar_url":"https://github.com/lrlna.png","language":"JavaScript","readme":"# http2-request\n[![npm version][1]][2] [![build status][3]][4]\n[![downloads][5]][6] [![js-standard-style][7]][8]\n\nSuper smol HTTP/2 request library :package:. Optimized for JSON APIs. \n\n## Usage\n```js\nvar request = require('http2-request')\nvar fs = require('fs')\n\nvar opts = {\n  url: 'https://localhost:8001',\n  connectOpts: {\n    ca: fs.readFileSync('~/http2-request/cert.pem')\n  },\n  clientOpts: {},\n  headers: {\n    ':path': '/'\n  }\n}\n\nrequest(opts, function (err, headers, body) {\n  if (err) throw err\n  if (!headers.isOk()) throw new Error(`statusCode is ${headers.statusCode}`)\n  console.log('headers', headers)\n  console.log('body', body)\n})\n```\n\n## API \n### request(opts, cb)\nCreate a new instance of `http2-request`. Takes a few options to connect to an\nHTTP/2 client and create and HTTP/2 session:\n- __opts.headers:__ [headers\n  object](https://nodejs.org/api/http2.html#http2_headers_object) to pass in\nthe request.\n- __opts.json:__  Boolean, defaults to true. Returns either a JSON object or a\n  string when false.\n- __opts.url:__ A URL to send a request to. `http2-request` will create a `new\nURL` object to get the origin\n- __opts.clientOpts:__ HTTP/2 session [request\n  opts](https://nodejs.org/api/http2.html#http2_clienthttp2session_request_headers_options).\nWhen none are passed, will use defaults. \n- __opts.connectOpts:__ HTTP/2 [connect\n  options](https://nodejs.org/api/http2.html#http2_http2_connect_authority_options_listener).\nWhen none are passed, will use defaults. If you're developing locally, pass in\n`{ rejectUnauthorized: false }` to avoid rejections from the server, otherwise\npass in a cert under the `ca` flag.\n\n#### response\nRequest has a signature of `(err, headers, body)`:\n- __err:__ err from either a connection or a request.\n- __headers:__ HTTP/2 errors object returned from the response.\n- __body:__ Response body. Will return a string if `opts.json` is false,\n  otherwise a JSON object.\n\n#### headers.isOK()\nA convenience method to see if the response comes back `\u003c=299` for easier error\nchecking. Returns a boolean.\n\n#### headers.statusCode\nA convenience method from HTTP/1.1 to read off the status code. You can also do\nso by `headers[:status]`.\n\n# Install\n```bash\nnpm install http2-request\n```\n\n## License\n[Apache-2.0](https://tldrlegal.com/license/apache-license-2.0-(apache-2.0))\n\n[1]: https://img.shields.io/npm/v/http2-request.svg?style=flat-square\n[2]: https://npmjs.org/package/http2-request\n[3]: https://img.shields.io/travis/lrlna/http2-request/master.svg?style=flat-square\n[4]: https://travis-ci.com/lrlna/http2-request \n[5]: http://img.shields.io/npm/dm/http2-request.svg?style=flat-square\n[6]: https://npmjs.org/package/http2-request\n[7]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square\n[8]: https://github.com/feross/standard\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flrlna%2Fhttp2-request","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flrlna%2Fhttp2-request","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flrlna%2Fhttp2-request/lists"}