Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support http header encode #11

Merged
merged 7 commits into from
Jul 3, 2019
Merged

Support http header encode #11

merged 7 commits into from
Jul 3, 2019

Conversation

guonaihong
Copy link
Owner

内容请见 #9

伪代码

out := gout.New(nil)
code := 0

if err := out.GET(":8080/testquery").ToHeader().Code(&code).Do(); err != nil {
}

ToHeader支持的类型有

  • map[string]interface{},可以使用gout.H别名
  • struct
  • array, slice(长度必须是偶数)
// gout.H 或者 map[string]interface{}
ToHeader(gout.H{
    "check_in":"2019-06-18",
    "check_out":"2019-06-18",
})

// struct
type testHeader struct {
    CheckIn string `header:checkin`
    CheckOut string `header:checkout`
}

ToHeader(&testHeader{CheckIn:2019-06-18, CheckOut:2019-06-18})

// array or slice
// -H active:enable -H action:drop
ToHeader([]string{"active", "enable", "action", "drop"})

@guonaihong guonaihong merged commit e4b0616 into master Jul 3, 2019
@guonaihong guonaihong deleted the support-http-header branch July 3, 2019 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant