Patched it for some apple devices pretending to be chromium
This commit is contained in:
parent
f5b3297d9d
commit
c55ae178b4
9
main.go
9
main.go
|
@ -655,7 +655,8 @@ func Get(url string) (response *Response, err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !strings.HasPrefix(url, "https://") && !js.Global().Get("chrome").IsUndefined() {
|
// Disable if not https, we don't detect chromium, or we are on safari
|
||||||
|
if !strings.HasPrefix(url, "https://") || !js.Global().Get("chrome").IsUndefined() || strings.Contains(js.Global().Get("navigator").Get("userAgent").String(), "Safari") {
|
||||||
request.DisableStreamedClient = true
|
request.DisableStreamedClient = true
|
||||||
}
|
}
|
||||||
response, err = Fetch.Do(request)
|
response, err = Fetch.Do(request)
|
||||||
|
@ -671,7 +672,8 @@ func Post(url string, contentType string, body io.Reader) (response *Response, e
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !strings.HasPrefix(url, "https://") && !js.Global().Get("chrome").IsUndefined() {
|
// Disable if not https, we don't detect chromium, or we are on safari
|
||||||
|
if !strings.HasPrefix(url, "https://") || !js.Global().Get("chrome").IsUndefined() || strings.Contains(js.Global().Get("navigator").Get("userAgent").String(), "Safari") {
|
||||||
request.DisableStreamedClient = true
|
request.DisableStreamedClient = true
|
||||||
}
|
}
|
||||||
request.Header.Add("Content-Type", contentType)
|
request.Header.Add("Content-Type", contentType)
|
||||||
|
@ -690,7 +692,8 @@ func PostForm(url string, data url.Values) (response *Response, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
request.Header.Add("Content-Type", "application/x-www-form-urlencoded")
|
request.Header.Add("Content-Type", "application/x-www-form-urlencoded")
|
||||||
if !strings.HasPrefix(url, "https://") && !js.Global().Get("chrome").IsUndefined() {
|
// Disable if not https, we don't detect chromium, or we are on safari
|
||||||
|
if !strings.HasPrefix(url, "https://") || !js.Global().Get("chrome").IsUndefined() || strings.Contains(js.Global().Get("navigator").Get("userAgent").String(), "Safari") {
|
||||||
request.DisableStreamedClient = true
|
request.DisableStreamedClient = true
|
||||||
}
|
}
|
||||||
response, err = Fetch.Do(request)
|
response, err = Fetch.Do(request)
|
||||||
|
|
Loading…
Reference in New Issue