https://github.com/killlowkey/parse-curl
parse-curl.js golang version. Parse curl commands, returning an object representing the request. 解析 curl 命令,返回一个表示请求的对象
https://github.com/killlowkey/parse-curl
curl parser
Last synced: 6 days ago
JSON representation
parse-curl.js golang version. Parse curl commands, returning an object representing the request. 解析 curl 命令,返回一个表示请求的对象
- Host: GitHub
- URL: https://github.com/killlowkey/parse-curl
- Owner: killlowkey
- Created: 2021-11-06T00:25:41.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-01-12T03:04:13.000Z (about 3 years ago)
- Last Synced: 2024-11-14T16:48:22.253Z (about 1 year ago)
- Topics: curl, parser
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 12
- Watchers: 1
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# parse-curl
Parse curl commands, returning an object representing the request.
## Example
```shell
curl 'http://google.com/' \
-H 'Accept-Encoding: gzip, deflate, sdch' \
-H 'Accept-Language: en-US,en;q=0.8,da;q=0.6' \
-H 'Upgrade-Insecure-Requests: 1' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' \
-H 'Connection: keep-alive' \
--compressed
```
out
```json
{
"method": "GET",
"url": "http://google.com/",
"header": {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"Accept-Encoding": "gzip, deflate, sdch",
"Accept-Language": "en-US,en;q=0.8,da;q=0.6",
"Connection": "keep-alive",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36"
},
"body": ""
}
```
## Reference
* https://github.com/tj/parse-curl.js