{"id":24770321,"url":"https://github.com/dubniczky/httparser","last_synced_at":"2025-03-23T19:41:37.786Z","repository":{"id":63387584,"uuid":"567033748","full_name":"dubniczky/Httparser","owner":"dubniczky","description":"Simple HTTP request and response parser, written in pure javascript with zero dependencies","archived":false,"fork":false,"pushed_at":"2022-11-25T23:17:50.000Z","size":62,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-01T03:26:16.216Z","etag":null,"topics":["http","javascript","no-dependencies","pure-javascript","request","response"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dubniczky.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":"2022-11-16T23:35:41.000Z","updated_at":"2022-11-16T23:40:10.000Z","dependencies_parsed_at":"2023-01-22T06:50:18.424Z","dependency_job_id":null,"html_url":"https://github.com/dubniczky/Httparser","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dubniczky%2FHttparser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dubniczky%2FHttparser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dubniczky%2FHttparser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dubniczky%2FHttparser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dubniczky","download_url":"https://codeload.github.com/dubniczky/Httparser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245162010,"owners_count":20570690,"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","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":["http","javascript","no-dependencies","pure-javascript","request","response"],"created_at":"2025-01-29T03:37:25.052Z","updated_at":"2025-03-23T19:41:37.773Z","avatar_url":"https://github.com/dubniczky.png","language":"JavaScript","readme":"# Httparser\n\nSimple HTTP request and response parser, written in pure javascript with zero dependencies\n\n## Usage\n\n### Install the package\n\nUse any of the following package managers\n\n```bash\nnpm add httparser\nyarn add httparser\npnpm add httparser\n```\n\n### Import \n\nNote: the package only supports ES3 imports for now\n\n```js\nimport { HTTPRequest, HTTPResponse } from 'httparser'\n```\n\n### Parse a file\n\nRequest\n\n```js\nimport fs from 'fs'\nimport { HTTPRequest } from 'httparser'\n\nconst data = fs.readFileSync('example.http', 'utf8')\nconst request = new HTTPRequest(data)\n\nconsole.log(request.method)\nconsole.log(request.headers['Host'])\nconsole.log(request.fragment)\n\nconsole.dir(request)\n```\n\nResponse\n\n```js\nimport fs from 'fs'\nimport { HTTPResponse } from 'httparser'\n\nconst data = fs.readFileSync('example.http', 'utf8')\nconst response = new HTTPResponse(data)\n\nconsole.log(response.reason)\nconsole.log(response.statusCode)\nconsole.log(response.body)\n\nconsole.dir(response)\n```\n\n### Body Parsing\n\nBy default, parsing JSON and form objects are supported. They can be explicitly turned off by using the following constructor:\n\n```js\nconst req = HTTPRequest(data, false)\n```\n\nOtherwise, parsed JSON will be added to the `json` property, and a parsed form will be added to the ","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdubniczky%2Fhttparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdubniczky%2Fhttparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdubniczky%2Fhttparser/lists"}