valyala/fasthttp

More examples of fasthttp Client usage?

クローズ

#599 opened on 2019/07/04

 (31 件のコメント) (3 件のリアクション) (0 人の担当者)Go (1,755 件のフォーク)batch import
help wantedquestion

Repository metrics

Stars
 (21,741 個のスター)
PR merge metrics
 (平均マージ 3d) (30d で 44 merged PRs)

説明

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.

コントリビューターガイド