curl-express
convert request to curl cmd
Install
npm install curl-express
Usage
Make sure curl-express middleware is placed after body paser,multipart handling middlewares
const express = ;const curlExpress = ; const app = ;const port = 3000; app;app; // curl-express middleware// it is placed after body paser,multipart handling middlewaresapp; // user can define omitted header or body payload// Example:// => app.use(curlExpress({omittedKeys: ['authorization']})); appall'*' { const curlcmd = req; console; // => curl -X GET 'http://localhost:3000/' -H 'host: localhost:3000' -H 'connection: keep-alive' -H 'upgrade-insecure-requests: 1' -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-user: ?1' -H 'dnt: 1' -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3' -H 'sec-fetch-site: none' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: my,en-US;q=0.9,en;q=0.8' -H 'cookie: test=test' -H 'if-none-match: W/"c-Lve95gjOVATpfV8EL5X4nxwjKHE"' res;}; app;
Development
Docker Build
docker-compose build
Docker Run
docker-compose run curl-express
Install Dependencies
npm i
Run Test
npm t
License
MIT © Aung Myo Kyaw