I'm not familiar with napping, but using Golang's net/http package works fine (playground):

func main() {
    url := "http://restapi3.apiary.io/notes"
    fmt.Println("URL:>", url)

    var jsonStr = []byte(`{"title":"Buy cheese and bread for breakfast."}`)
    req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr))
    req.Header.Set("X-Custom-Header", "myvalue")
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
    defer resp.Body.Close()

    fmt.Println("response Status:", resp.Status)
    fmt.Println("response Headers:", resp.Header)
    body, _ := ioutil.ReadAll(resp.Body)
    fmt.Println("response Body:", string(body))

How do I send a JSON string in a POST request in Go - Stack Overflow


I'm not familiar with napping, but using Golang's net/http package works fine ( playground): func main() { url := "http://restapi3.apiary.io/notes" fmt ...

http - The Go Programming Language


Manually configuring HTTP/2 via the golang.org/x/net/http2 package takes ... URL , error): func Redirect(w ResponseWriter, r *Request, url string, code int): func ...

golang 发送GET和POST示例- SegmentFault 思否


2018年2月11日 ... func main() { params := url.Values{} Url, err := url.Parse("http://baidu.com?fd=fdsf" ) if err != nil { panic(err.Error()) } params.Set("a", "fdfds") ...

Making external HTTP requests in Go | by Uday Hiwarale | RunGo ...


Mar 17, 2020 ... Golang: HTTP & Networking ... When a browser sends an HTTP request to a server, it sends a ... func Post(url, contentType string, body io.

Go GET/POST request - ZetCode


Jan 14, 2021 ... ... tutorial shows how tosend HTTP GET and POST requests in golang. ... The following example appends query parameters to the URL.

Making HTTP Requests in Golang. How I make http requests in ...


Feb 3, 2019 ... Post . This function takes the url, the content type we're using (in our case JSON) and an instance of io.Reader . At our hands, we have a []byte ...

golang post请求常用的几种方式_mofiu的博客-CSDN博客_golang ...


2018年4月13日 ... post请求常用的几种方式,记录一下func httpPost() { resp, err := http. ... PostForm(" https://www.denlery.top/api/v1/login", url.Values{"username": ...

Making HTTP requests in Go - LogRocket Blog


Sep 14, 2020 ... ... in exploring how you can make HTTP requests in Golang or Go, as I will ... To make the request, we invoke the Get function, passing in a URL ...

POST with NewRequest using Golang · GitHub


package main. import (. "bytes". "fmt". "io/ioutil". "log". "net/http". "net/url". ) const (. clientSecret string = "9ca19353e1fb861f6d3aed8af6803c0b". accessToken ...

Mocking HTTP Requests in Golang


Jan 14, 2020 ... Post sends a post request to the URL with the body. func Post(url string, body interface{}, headers http.Header) (*http.Response, error) {.