최신판 |
당신의 편집 |
10번째 줄: |
10번째 줄: |
| "net/http" | | "net/http" |
|
| |
|
| "moul.io/http2curl" | | "github.com/moul/http2curl" |
| ) | | ) |
|
| |
|
32번째 줄: |
32번째 줄: |
| } | | } |
| </syntaxhighlight> | | </syntaxhighlight> |
| <syntaxhighlight lang='go' run>
| |
| package main
| |
|
| |
|
| import (
| |
| "bytes"
| |
| "fmt"
| |
| "net/http"
| |
|
| |
| "moul.io/http2curl"
| |
| )
| |
|
| |
| func main() {
| |
| data := bytes.NewBufferString(`{"hello":"world","answer":42}`)
| |
| req, _ := http.NewRequest("PUT", "http://www.example.com/abc/def.ghi?jlk=mno&pqr=stu", data)
| |
| req.Header.Set("Content-Type", "application/json")
| |
|
| |
| command, _ := http2curl.GetCurlCommand(req)
| |
| fmt.Println(command)
| |
| }
| |
| </syntaxhighlight>
| |
|
| |
|
| ==같이 보기== | | ==같이 보기== |
58번째 줄: |
39번째 줄: |
| ==참고== | | ==참고== |
| * https://github.com/moul/http2curl | | * https://github.com/moul/http2curl |
| * https://pkg.go.dev/moul.io/http2curl/v2
| |
|
| |
|
| [[분류: Go]] | | [[분류: Go]] |