Skip to content

Releases: guonaihong/gout

v0.3.0版本

21 Jul 16:39
1d93dc6
Compare
Choose a tag to compare

支持多个对象的绑定。

var responseStruct struct {
		Name string `json:"name"`
		Age  int    `json:"age"`
	}
	var responseStr string

	gout.GET("url").
		SetQuery(gout.H{}).
		BindJSON(&responseStruct).
		BindBody(&responseStr).
		Do()

	log.Println(responseStr)
	// do something with responseStruct ...

v0.2.12版本

04 Apr 14:44
aa01ed1
Compare
Choose a tag to compare

v0.2.11版本

02 Jan 05:58
24b2222
Compare
Choose a tag to compare

更新标准扩展库sys版本号.

在mac+go1.17的组合下面sys库会runtime panic.

v0.2.10

07 Nov 14:11
Compare
Choose a tag to compare

新增功能如下:

增加MiddlerFunc Helper 感谢 @Sora233
SetQuery和SetHeader等API int 类型0值序列化为空字符串 现改为"0",

v0.2.9版本

26 Sep 16:17
98659b5
Compare
Choose a tag to compare

优化SetXXX函数, 传递nil 会panic的现象. 感谢 @listening3

v0.2.8版本

19 Sep 15:43
Compare
Choose a tag to compare

v0.2.7版本

10 Sep 03:36
d943327
Compare
Choose a tag to compare

本次功能如下:

  • 新增结果中间件, 感谢 @yangheng-git
  • 修复host写完整url, url内容不对的情况 感谢 @TMaize

结果中间件用法如下.
https://github.com/guonaihong/gout#responseuse

v0.2.6版本

26 Aug 12:39
19c67f1
Compare
Choose a tag to compare

详细的讨论可看 #306

import (
	"fmt"
	"github.com/guonaihong/gout"
)

type testValid struct {        
        Val string `valid:"required"`   
} 

func main() {
	tv := testValid{}
	err := gout.
		// 设置POST方法和url
		POST(":8080/req/body").
		//打开debug模式
		Debug(true).
		//解析json, 并且当需要的字段没有值时, 返回错误
		BindJSON(&tv).
		//结束函数
		Do()

	if err != nil {
		fmt.Printf("%s\n", err)
		return
	}

}

v0.2.5版本

22 Aug 09:51
Compare
Choose a tag to compare

详细设计可看 #305
本次功能优化在使用query string时,可以使用更丰富的数据结构。

package main

import "github.com/guonaihong/gout"

type query struct {
        A []string `query:"a"`
}

func main() {
        gout.GET(":8080/").SetQuery(query{A: []string{"1", "2", "3"}}).Do()
}

客户端请求的包如下:

GET /?a=1&a=2&a=3 HTTP/1.1
Host: 127.0.0.1:8080
User-Agent: Go-http-client/1.1
Accept-Encoding: gzip

v0.2.4版本

02 Aug 05:24
3f8acf7
Compare
Choose a tag to compare

新增Response接口

func main() {
	

	resp, err := gout.GET(":8080").SetJSON(`{"test":"value"}`).Response()

	if resp != nil {
		defer resp.Body.Close()
	}
}