Skip to content

Commit

Permalink
[EXAMPLE] Basic Authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
telanflow committed Jul 23, 2020
1 parent ef5c963 commit c42d5dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@ func main() {
// request
resp, err := quick.Get(
"http://example.com?bb=1",
quick.OptionQueryString("name=quick&aa=11"), // set Get params eg. "example.com?bb=1&name=quick&aa=11"
quick.OptionHeaderSingle("User-Agent", ""), // set http header
quick.OptionHeader(http.Header{}), // set http header eg. http.Header || map[string]string || []string
quick.OptionRedirectNum(10), // set redirect num
quick.OptionCookies(cookies), // set cookies to request
quick.OptionQueryString("name=quick&aa=11"), // set Get params eg. "example.com?bb=1&name=quick&aa=11"
quick.OptionHeaderSingle("User-Agent", ""), // set http header
quick.OptionHeader(http.Header{}), // set http header eg. http.Header || map[string]string || []string
quick.OptionRedirectNum(10), // set redirect num
quick.OptionCookies(cookies), // set cookies to request
// quick.OptionProxy("http://127.0.0.1:8080"), // set proxy address
// quick.OptionBody(""), // POST body
// quick.OptionBasicAuth("username", "password"), // HTTP Basic Authentication
// ... quick.Option
)
if err != nil {
Expand Down
5 changes: 3 additions & 2 deletions examples/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,14 @@ func main() {
// request
resp, err := quick.Get(
"http://www.baidu.com?bb=1",
quick.OptionQueryString("name=quick&aa=11"), // set Get params eg. "example.com?bb=1&name=quick&aa=11"
quick.OptionQueryString("name=quick&aa=11"), // set Get params eg. "example.com?bb=1&name=quick&aa=11"
//quick.OptionProxy("http://127.0.0.1:8080"), // set proxy
//quick.OptionHeaderSingle("User-Agent", ""), // set http header
//quick.OptionHeader(http.Header{}), // set http header eg. http.Header || map[string]string || []string
//quick.OptionRedirectNum(10), // set redirect num
quick.OptionCookies(cookies), // set cookies to request
// quick.OptionBody(""), // POST body
// quick.OptionBody(""), // POST body
// quick.OptionBasicAuth("username", "password"), // HTTP Basic Authentication
// ... quick.Option
)
if err != nil {
Expand Down

0 comments on commit c42d5dc

Please sign in to comment.