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

suport global options #42

Merged
merged 2 commits into from
Nov 2, 2016
Merged

suport global options #42

merged 2 commits into from
Nov 2, 2016

Conversation

zwczou
Copy link
Contributor

@zwczou zwczou commented Nov 1, 2016

package main

import (
	"log"
	"net/http/httputil"

	"github.com/zwczou/grequests"
)

func main() {
	sess := grequests.NewSession(&grequests.RequestOptions{
		Headers: map[string]string{
			"Accept": "*/*",
		},
		UserAgent: "client/1.0",
	})

	resp, err := sess.Get("http://baidu.com", nil)
	if err != nil {
		log.Fatal(err)
	}
	body, err := httputil.DumpRequest(resp.RawResponse.Request, true)
	if err != nil {
		log.Fatal(err)
	}
	println(string(body))
}```

@levigross
Copy link
Owner

@zwczou Thank you very much 😄 I do have a non-descriptive task to clean sessions up (#34) but this is a great start!

@levigross levigross merged commit 5425509 into levigross:master Nov 2, 2016
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.

2 participants