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 {
        panic(err)
    }
    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

https://stackoverflow.com/questions/24455147/how-do-i-send-a-json-string-in-a-post-request-in-go

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

https://golang.org/pkg/net/http/

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 思否

https://segmentfault.com/a/1190000013262746

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 ...

https://medium.com/rungo/making-external-http-requests-in-go-eb4c015f8839

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

https://zetcode.com/golang/getpostrequest/

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 ...

https://medium.com/@masnun/making-http-requests-in-golang-dd123379efe7

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 ...

https://blog.csdn.net/mofiu/article/details/79925994

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

https://blog.logrocket.com/making-http-requests-in-go/

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

https://gist.github.com/17twenty/2fb30a22141d84e52446

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

Mocking HTTP Requests in Golang

https://www.thegreatcodeadventure.com/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) {.