gout v0.1.2 发布,Golang 实现的 http 客户端

项目地址

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()
}

猜你喜欢

转载自www.oschina.net/news/117750/gout-0-1-2-released