@amaui/request
TypeScript icon, indicating that this package has built-in type declarations

1.1.7 • Public • Published

amaui logo

amaui Request

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 💛


Getting started

Add

  yarn add @amaui/request

Use

  import AmauiRequest from '@amaui/request';

  // Make a new AmauiRequest instance
  const amauiRequest = new AmauiRequest();

  await amauiRequest.get('https://jsonplaceholder.typicode.com/posts/4');

  // or as a static method without a new instance
  await AmauiRequest.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

  yarn

Test

  yarn test

Prod

Build

  yarn build

Package Sidebar

Install

npm i @amaui/request

Weekly Downloads

69

Version

1.1.7

License

MIT

Unpacked Size

332 kB

Total Files

11

Last publish

Collaborators

  • lazareric