https://github.com/onesy-me/request
Request
https://github.com/onesy-me/request
amaui back-end backend browser front-end frontend http https javascript js node nodejs request requests typescript utils web
Last synced: about 1 month ago
JSON representation
Request
- Host: GitHub
- URL: https://github.com/onesy-me/request
- Owner: onesy-me
- License: mit
- Created: 2022-02-03T16:05:52.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-02-27T18:38:54.000Z (about 1 year ago)
- Last Synced: 2025-09-25T19:23:43.803Z (6 months ago)
- Topics: amaui, back-end, backend, browser, front-end, frontend, http, https, javascript, js, node, nodejs, request, requests, typescript, utils, web
- Language: TypeScript
- Homepage: https://docs.onesy.me/library/request
- Size: 588 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
onesy Request
MIT license
Production ready
UMD 18.1kb gzipped
100% test cov
Browser and Nodejs
Very simple code
Modern code
Junior friendly
Typescript
Made with :yellow_heart:
### Add
```sh
yarn add @onesy/request
```
### Use
```javascript
import OnesyRequest from '@onesy/request';
// Make a new OnesyRequest instance
const onesyRequest = new OnesyRequest();
await onesyRequest.get('https://jsonplaceholder.typicode.com/posts/4');
// or as a static method without a new instance
await OnesyRequest.get('https://jsonplaceholder.typicode.com/posts/4');
// {
// response: {
// userId: 1,
// id: 4,
// title: 'eum et est occaecati',
// body: 'ullam et saepe reiciendis voluptatem adipisci\nsit amet autem assumenda provident rerum culpa\nquis hic commodi nesciunt rem tenetur doloremque ipsam iure\nquis sunt voluptatem rerum illo velit'
// },
// status: 200,
// headers: {
// cache-control: 'max-age=43200',
// content-type: 'application/json; charset=utf-8',
// expires: -1,
// pragma: 'no-cache'
// },
// request: {
// headers: {
// Accept: 'application/json, text/plain, */*'
// }
// },
// options: {
// method: 'GET',
// url: 'https://jsonplaceholder.typicode.com/posts/4',
// request: {
// headers: {
// Accept: 'application/json, text/plain, */*'
// },
// csrf: {
// cookie: 'CSRF-TOKEN',
// headers: 'X-CSRF-TOKEN'
// }
// },
// response: {
// resolveOnError: true,
// type: 'json',
// parse: {
// json: true
// }
// }
// }
// }
```
### Dev
Install
```sh
yarn
```
Test
```sh
yarn test
```
### Prod
Build
```sh
yarn build
```