translate http.go
This commit is contained in:
+3
-2
@@ -19,6 +19,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/mmcdole/gofeed"
|
||||
"golang.nytpu.com/comitium/localizations"
|
||||
|
||||
"golang.nytpu.com/comitium/core"
|
||||
)
|
||||
@@ -42,7 +43,7 @@ func fetchHTTP(remoteURL string) (*http.Response, error) {
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
resp.Body.Close()
|
||||
return nil, fmt.Errorf("Unexpected HTTP response %s", resp.Status)
|
||||
return nil, fmt.Errorf(core.Localizer.Get("errors.http_bad_response", &localizations.Replacements{"status": resp.Status}))
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
@@ -58,7 +59,7 @@ func httpFeed(data *core.FullData, remote string, title string) error {
|
||||
|
||||
if resp.Header.Get("Content-Type") == "text/html" {
|
||||
// TODO
|
||||
return fmt.Errorf("Extracting feed from HTML pages is currently unsupported.")
|
||||
return fmt.Errorf(core.Localizer.Get("errors.http_no_extract"))
|
||||
}
|
||||
|
||||
reader := io.LimitReader(resp.Body, 1073741824) // 1 GiB
|
||||
|
||||
Reference in New Issue
Block a user