Last active
June 22, 2018 13:49
-
-
Save joaolsilva/d24b7bf5602f0d6615eb5d385fd0ffdc to your computer and use it in GitHub Desktop.
malformed MIME header line: Content-Disposition = attachment; filename=file.asc
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
package main | |
import ( | |
"io/ioutil" | |
"log" | |
"net/http" | |
"time" | |
) | |
const url = "http://ruby.streamguys.com:8120/status2.xsl?mount=/live" | |
func main() { | |
log.SetFlags(log.Flags() | log.Lshortfile) | |
client := http.Client{ | |
Timeout: 10 * time.Second, | |
} | |
req, err := http.NewRequest("GET", url, nil) | |
if err != nil { | |
log.Printf("err: %v", err) | |
return | |
} | |
resp, err := client.Do(req) | |
if err != nil { | |
log.Printf("err: %v", err) | |
return | |
} | |
defer resp.Body.Close() | |
b, err := ioutil.ReadAll(resp.Body) | |
if err != nil { | |
log.Printf("err: %v", err) | |
return | |
} | |
log.Printf("Received %v bytes", len(b)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment