Last active
April 19, 2016 04:58
-
-
Save brnstz/a9a3e9ce063402ac35bfbfc4846839b2 to your computer and use it in GitHub Desktop.
wikimg http cancel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (p *Puller) FirstColor(imgURL string) (xtermColor int, hex string, err error) { | |
// Create a request so we can use req.Cancel | |
req, err := http.NewRequest("GET", imgURL, nil) | |
if err != nil { | |
return | |
} | |
// Set up cancellation pipeline, link request to puller | |
req.Cancel = p.Cancel | |
// etc... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment