Compare commits

..

No commits in common. "619a2a89294eebe76b5c14ceed7945cb40d2ee4e" and "732a8889dcae1bc879d47aba351124e96c35c004" have entirely different histories.

1 changed files with 2 additions and 2 deletions

View File

@ -24,7 +24,7 @@ func title(url string) error {
}
// 直到包含defer的函数执行完毕之后defer的这条语句才会执行
defer resp.Body.Close()
// Check Content-Type is Html (e.g., "text/html;charset=utf-8").
// Check Content-Type is HTML (e.g., "text/html;charset=utf-8").
ct := resp.Header.Get("Content-Type")
if ct != "text/html" && !strings.HasPrefix(ct, "text/html;") {
return fmt.Errorf("%s has type %s, not text/html", url, ct)
@ -32,7 +32,7 @@ func title(url string) error {
doc, err := html.Parse(resp.Body)
if err != nil {
return fmt.Errorf("parsing %s as Html: %v", url, err)
return fmt.Errorf("parsing %s as HTML: %v", url, err)
}
visitNode := func(n *html.Node) {
if n.Type == html.ElementNode && n.Data == "title" && n.FirstChild != nil {