mirror of
https://github.com/Kong/insomnia.git
synced 2026-10-27 17:19:42 -04:00
29 lines
547 B
Go
Executable File
29 lines
547 B
Go
Executable File
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
"net/http"
|
|
"io/ioutil"
|
|
)
|
|
|
|
func main() {
|
|
|
|
url := "http://mockbin.com/har"
|
|
|
|
payload := strings.NewReader("{\"number\":1,\"string\":\"f\\\"oo\",\"arr\":[1,2,3],\"nested\":{\"a\":\"b\"},\"arr_mix\":[1,\"a\",{\"arr_mix_nested\":{}}],\"boolean\":false}")
|
|
|
|
req, _ := http.NewRequest("POST", url, payload)
|
|
|
|
req.Header.Add("content-type", "application/json")
|
|
|
|
res, _ := http.DefaultClient.Do(req)
|
|
|
|
defer res.Body.Close()
|
|
body, _ := ioutil.ReadAll(res.Body)
|
|
|
|
fmt.Println(res)
|
|
fmt.Println(string(body))
|
|
|
|
}
|