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

Conditional GET convenience method #6

Closed
davecheney opened this issue Jul 28, 2013 · 0 comments
Closed

Conditional GET convenience method #6

davecheney opened this issue Jul 28, 2013 · 0 comments

Comments

@davecheney
Copy link
Contributor

Suggestion from dsal for a Conditional GET helper

type ReaderMaker func() (io.Reader, error)

// ConditionalGet writes the body of url to w if the server provides a 200 response.
// If the response is 304, f is called to provide an io.Reader which will provide the body.
// If f is nil, and a 304 is encounted, StatusError{304} will be returned.
func ConditionalGet(w io.Writer, url, etag string, modtime time.Time, f ReaderMaker) (int64, error)

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

No branches or pull requests

2 participants