valyala/fasthttp

More examples of fasthttp Client usage?

已關閉

#599 建立於 2019年7月4日

 (31 則留言) (3 個反應) (0 位負責人)Go (1,755 個分叉)batch import
help wantedquestion

倉庫指標

星標
 (21,741 顆星)
PR 合併指標
 (平均合併 3天) (30 天內合併 44 個 PR)

描述

Hi,

Being new to Go lang, it would be much appreciated if this library had more examples of using HTTP client in a right way.

The only way I've found so far was from blog post found on internet.

func doRequest(url string) {
        req := fasthttp.AcquireRequest()
        req.SetRequestURI(url)

        resp := fasthttp.AcquireResponse()
        client := &fasthttp.Client{}
        client.Do(req, resp)

        bodyBytes := resp.Body()
        println(string(bodyBytes))
        // User-Agent: fasthttp
        // Body:
}

But I don't know if this is optimal resource wise, since I need to make really huge number of GET and POST requests, and Go seems like good language for that.

貢獻者指南