https://gitee.com/guonaihong/gout
https://github.com/guonaihong/gout
#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
]