Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
aladdin-add committed Oct 25, 2022
0 parents commit ad6a6d0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
16 changes: 16 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "repro",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "weiran",
"license": "ISC",
"dependencies": {
"axios": "^0.27.2",
"axios-curlirize": "^2.0.0"
}
}
10 changes: 10 additions & 0 deletions serve.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import axios from 'axios';
import curlirize from 'axios-curlirize';


const ax = axios.create({ baseURL: 'http://x.d.so:8080' });
// ax.interceptors.response.use((res) => res.data)
curlirize(ax);

ax.post('/api/v1/xxx', { data: { name: 'nicholas' } });
// output: `curl -X POST "http://x.d.so:8080/api/v1/xxx" -H "Content-Type:application/x-www-form-urlencoded" --data '{"data":{"name":"nicholas"}}'`

0 comments on commit ad6a6d0

Please sign in to comment.