Debian Codegraph @

README.md

raw symbols SCIP
1 # http2curl
2
3 :triangular_ruler: Convert Golang's http.Request to CURL command line
4
5 [![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white)](https://pkg.go.dev/moul.io/http2curl)
6 [![License](https://img.shields.io/badge/license-Apache--2.0%20%2F%20MIT-%2397ca00.svg)](https://github.com/moul/http2curl/blob/master/COPYRIGHT)
7 [![GitHub release](https://img.shields.io/github/release/moul/http2curl.svg)](https://github.com/moul/http2curl/releases)
8 [![Docker Metrics](https://images.microbadger.com/badges/image/moul/http2curl.svg)](https://microbadger.com/images/moul/http2curl)
9 [![Made by Manfred Touron](https://img.shields.io/badge/made%20by-Manfred%20Touron-blue.svg?style=flat)](https://manfred.life/)
10
11 [![Go](https://github.com/moul/http2curl/workflows/Go/badge.svg)](https://github.com/moul/http2curl/actions?query=workflow%3AGo)
12 [![Release](https://github.com/moul/http2curl/workflows/Release/badge.svg)](https://github.com/moul/http2curl/actions?query=workflow%3ARelease)
13 [![PR](https://github.com/moul/http2curl/workflows/PR/badge.svg)](https://github.com/moul/http2curl/actions?query=workflow%3APR)
14 [![GolangCI](https://golangci.com/badges/github.com/moul/http2curl.svg)](https://golangci.com/r/github.com/moul/http2curl)
15 [![codecov](https://codecov.io/gh/moul/http2curl/branch/master/graph/badge.svg)](https://codecov.io/gh/moul/http2curl)
16 [![Go Report Card](https://goreportcard.com/badge/moul.io/http2curl)](https://goreportcard.com/report/moul.io/http2curl)
17 [![CodeFactor](https://www.codefactor.io/repository/github/moul/http2curl/badge)](https://www.codefactor.io/repository/github/moul/http2curl)
18
19 To do the reverse operation, check out [mholt/curl-to-go](https://github.com/mholt/curl-to-go).
20
21 ## Example
22
23 ```go
24 import (
25 "http"
26 "moul.io/http2curl"
27 )
28
29 data := bytes.NewBufferString(`{"hello":"world","answer":42}`)
30 req, _ := http.NewRequest("PUT", "http://www.example.com/abc/def.ghi?jlk=mno&pqr=stu", data)
31 req.Header.Set("Content-Type", "application/json")
32
33 command, _ := http2curl.GetCurlCommand(req)
34 fmt.Println(command)
35 // Output: curl -X PUT -d "{\"hello\":\"world\",\"answer\":42}" -H "Content-Type: application/json" http://www.example.com/abc/def.ghi?jlk=mno&pqr=stu
36 ```
37
38 ## Install
39
40 ```bash
41 go get moul.io/http2curl
42 ```
43
44 ## Usages
45
46 - https://github.com/parnurzeal/gorequest
47 - https://github.com/scaleway/scaleway-cli
48 - https://github.com/nmonterroso/cowsay-slackapp
49 - https://github.com/moul/as-a-service
50 - https://github.com/gavv/httpexpect
51 - https://github.com/smallnest/goreq
52
53 ## License
54
55 © 2019-2021 [Manfred Touron](https://manfred.life)
56
57 Licensed under the [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0) ([`LICENSE-APACHE`](LICENSE-APACHE)) or the [MIT license](https://opensource.org/licenses/MIT) ([`LICENSE-MIT`](LICENSE-MIT)), at your option. See the [`COPYRIGHT`](COPYRIGHT) file for more details.
58
59 `SPDX-License-Identifier: (Apache-2.0 OR MIT)`