0.0.23 • Published 2 months ago

nestjs-convert-to-curl v0.0.23

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Covert Axios error to curl

$ npm i nestjs-convert-to-curl

Usage

// main.ts
// if your prefer to use in a global application

import { LogAxiosErrorInterceptor } from 'nestjs-convert-to-curl';

async function bootstrap() {
   .....
   app.useGlobalInterceptors(new LogAxiosErrorInterceptor());
}
curl --location -g --request POST 'http://url' --header 'Accept: application/json, text/plain, */*' --header 'Content-Type: application/json' --header 'User-Agent: axios/0.26.0' --header 'Content-Length: 13'  --data-raw '{"foo":"bar"}'

// service.ts
// If you prefer to use in a service.


import { AxiosConverter } from 'nestjs-convert-to-curl';

try {
  return await Axios.post('https://url', {
    foo: 'bar',
  });
} catch (error) {
  console.log(AxiosConverter.getCurl(error));
}
curl --location -g --request POST 'http://url' --header 'Accept: application/json, text/plain, */*' --header 'Content-Type: application/json' --header 'User-Agent: axios/0.26.0' --header 'Content-Length: 13'  --data-raw '{"foo":"bar"}'

The following is a list of all the people that have contributed to nestjs-convert-to-curl. Thanks for your contributions!

License

It is available under the MIT license. License

0.0.23

2 months ago

0.0.22

6 months ago

0.0.20

11 months ago

0.0.21

10 months ago

0.0.16

11 months ago

0.0.17

11 months ago

0.0.18

11 months ago

0.0.11

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.15

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago