歡迎您光臨本站 註冊首頁

gout v0.1.2 釋出,Golang 實現的 http 客戶端

←手機掃碼閱讀     admin @ 2020-08-07 , reply:0

專案地址

https://gitee.com/guonaihong/gout

https://github.com/guonaihong/gout

changlog

#241 上傳進度(在v0.0.4版本中介軟體裡面實現https://github.com/antlabs/gout-middleware)
#248 調整FormFile和FormType的優先順序
#250 新增關閉301中介軟體

 

上傳進度條

currBytes是已經上傳資料,totalBytes是資料總大小. currBytes/totalBytes就是上傳進度百分比


 package main
 
 import (
         "bytes"
         "github.com/antlabs/gout-middleware/request"
         "github.com/guonaihong/gout"
 )
 
 func main() {
         gout.POST(":8080").RequestUse(request.ProgressBar(func(currBytes, totalBytes int) {
 
                 fmt.Printf("%d:%d-->%f%%\n", currBytes, totalBytes, float64(currBytes)/float64(totalBytes))
         })).SetBody(strings.Repeat("1", 100000) /*這裡構造大點的測試資料,使用時換成真實業務資料,就可以看到效果*/).Do()
 }

[admin ]

來源:OsChina
連結:https://www.oschina.net/news/117750/gout-0-1-2-released
gout v0.1.2 釋出,Golang 實現的 http 客戶端已經有53次圍觀

http://coctec.com/news/all/show-post-247542.html