We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cc1aeb6 commit 11003daCopy full SHA for 11003da
1 file changed
query.go
@@ -109,8 +109,8 @@ func LoadURL(url string) (*html.Node, error) {
109
reader.Close()
110
}
111
}()
112
-
113
- switch resp.Header.Get("Content-Encoding") {
+ encoding := resp.Header.Get("Content-Encoding")
+ switch encoding {
114
case "gzip":
115
reader, err = gzip.NewReader(resp.Body)
116
if err != nil {
@@ -121,8 +121,10 @@ func LoadURL(url string) (*html.Node, error) {
121
122
return nil, err
123
124
- default:
+ case "":
125
reader = resp.Body
126
+ default:
127
+ return nil, fmt.Errorf("%s compression is not support", encoding)
128
129
130
r, err := charset.NewReader(reader, resp.Header.Get("Content-Type"))
0 commit comments