{"id":18291944,"url":"https://github.com/xxlabaza/request","last_synced_at":"2025-10-29T09:24:31.792Z","repository":{"id":40715684,"uuid":"272437486","full_name":"xxlabaza/request","owner":"xxlabaza","description":"HTTP requests wrapper","archived":false,"fork":false,"pushed_at":"2023-01-06T08:57:30.000Z","size":1342,"stargazers_count":0,"open_issues_count":15,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-25T16:45:02.669Z","etag":null,"topics":["fetch-api","http","node-fetch","utils"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xxlabaza.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-15T12:49:41.000Z","updated_at":"2020-06-15T14:24:21.000Z","dependencies_parsed_at":"2023-02-05T18:15:49.541Z","dependency_job_id":null,"html_url":"https://github.com/xxlabaza/request","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xxlabaza%2Frequest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xxlabaza%2Frequest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xxlabaza%2Frequest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xxlabaza%2Frequest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xxlabaza","download_url":"https://codeload.github.com/xxlabaza/request/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247999850,"owners_count":21031044,"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":["fetch-api","http","node-fetch","utils"],"created_at":"2024-11-05T14:15:47.508Z","updated_at":"2025-10-29T09:24:29.939Z","avatar_url":"https://github.com/xxlabaza.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Overview\n\n[![Build Status](https://travis-ci.com/xxlabaza/request.svg?branch=master)](https://travis-ci.com/xxlabaza/request)\n\n`request` - is a set of helper wrappers around `node-fetch`, which provides more convenient and safe approach to reqeust remote `HTTP`/`HTTPS` resources.\n\n## Usage\n\n\u003e installation:\n\u003e\n\u003e ```bash\n\u003e $\u003e npm install --save @xxlabaza/request\n\u003e ```\n\nExample:\n\n```typescript\nimport { Reqeust } from '@xxlabaza/request'\n\nconst result = await Reqeust.doGet('http://example.com/resource');\nif (result.isFailure()) {\n  console.log(result.error);\n  process.exit(1);\n}\n\nconst response = result.value;\nconsole.log(`status=${response.status.code}`);\nif (response.hasJson()) {\n  console.log(`body=${JSON.stringify(response.json)}`);\n} else if (response.hasText()) {\n  console.log(`body=${response.text}`);\n}\n```\n\n`POST` **JSON** request example:\n\n```typescript\nimport { Request } from '@xxlabaza/request';\n\nconst result = await Reqeust.post('http://example.com/resource')\n    .header('X-Custom-Header', '123')\n    .query('id', '1234')\n    .json({ text: 'Hello world!', key: true })\n    .execute();\n```\n\nThe different ways to write the same request:\n\n```typescript\nimport { Request } from '@xxlabaza/request';\n\nconst response = await Request.doGet('http://example.com/resource').orError();\n```\n\n```typescript\nimport { Request } from '@xxlabaza/request';\n\nconst result = await Request.doGet('http://example.com/resource');\nif (result.isFailure()) {\n  throw result.error;\n}\nconst response = result.value;\n```\n\n```typescript\nimport { Request } from '@xxlabaza/request';\n\nconst result = await Request.get('http://example.com/resource').execute();\nif (result.isFailure()) {\n  throw result.error;\n}\nconst response = result.value;\n```\n\n```typescript\nimport { Request } from '@xxlabaza/request';\n\nconst request = Request\n    .get('http://example.com/resource')\n    .build();\n\nconst result = await request.execute();\nif (result.isFailure()) {\n  throw result.error;\n}\nconst response = result.value;\n```\n\n```typescript\nimport { Request, HttpMethod } from '@xxlabaza/request';\n\nconst request = Request\n    .builder('http://example.com/resource')\n    .method(HttpMethod.GET)\n    .build();\n\nconst result = await request.execute();\nif (result.isFailure()) {\n  throw result.error;\n}\nconst response = result.value;\n```\n\n## Development\n\nThese instructions will get you a copy of the project up and running on your local machine for development and testing purposes.\n\n### Building\n\nTo build the project, do the following:\n\n```bash\n$\u003e npm run build\n...\n```\n\n### Running the tests\n\nTo run the project's test, do the following:\n\n```bash\n$\u003e npm test\n\n...\n\n PASS  src/tests/index.test.ts\n  server test\n    ✓ request empty GET (51 ms)\n    ✓ post JSON and read response (11 ms)\n\nTest Suites: 1 passed, 1 total\nTests:       2 passed, 2 total\nSnapshots:   0 total\nTime:        2.846 s\nRan all test suites.\n```\n\n## Changelog\n\nTo see what has changed in recent versions of the project, see the [changelog](./CHANGELOG.md) file.\n\n## Contributing\n\nPlease read [contributing](./CONTRIBUTING.md) file for details on my code of conduct, and the process for submitting pull requests to me.\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/appulse-projects/utils-java/tags).\n\n## Authors\n\n* **[Artem Labazin](https://github.com/xxlabaza)** - creator and the main developer\n\n## License\n\nThis project is licensed under the Apache License 2.0 License - see the [license](./LICENSE) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxxlabaza%2Frequest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxxlabaza%2Frequest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxxlabaza%2Frequest/lists"}