Go 的 HTTP 开发包:Fluent

jopen 9年前

Fluent 是 Go 语言的 HTTP 客户端开发包,支持超时、重试等。

示例代码:

package main     import (    "fmt"    "github.com/lafikl/fluent"    "time"  )     func main() {    req := fluent.New()    req.Post("http://example.com").      InitialInterval(time.Duration(time.Millisecond)).      Json([]int{1, 3, 4}).      Retry(3)       res, err := req.Send()       if err != nil {      fmt.Println(err)    }       fmt.Println("donne ", res)       // They can be separated if you don't like chaining ;)    // for example:    // req.Get("http://example.com")    // req.Retry(3)  }

项目主页:http://www.open-open.com/lib/view/home/1412901006014