[skip ci] small tweak in http client
This commit is contained in:
1 parent
754da7e836
commit
20f345593e
1 file changed
+12
-2
@@ -8,6 +8,8 @@ import "pkg:/source/utils/UrlUtils.bs"
|
|||||||
|
|
||||||
namespace HttpClient
|
namespace HttpClient
|
||||||
|
|
||||||
|
const COMPRESSION_ENABLED = true
|
||||||
|
|
||||||
function Get(url as string) as HttpRequest
|
function Get(url as string) as HttpRequest
|
||||||
return (new HttpRequest()).Method("GET").Url(url)
|
return (new HttpRequest()).Method("GET").Url(url)
|
||||||
end function
|
end function
|
||||||
@@ -188,7 +190,10 @@ namespace HttpClient
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
command += ` \\\n --max-time ${m._timeoutSeconds}`
|
command += ` \\\n --max-time ${m._timeoutSeconds}`
|
||||||
command += ` \\\n --compressed`
|
|
||||||
|
if COMPRESSION_ENABLED
|
||||||
|
command += ` \\\n --compressed`
|
||||||
|
end if
|
||||||
|
|
||||||
if m._headers <> invalid
|
if m._headers <> invalid
|
||||||
for each key in m._headers
|
for each key in m._headers
|
||||||
@@ -385,7 +390,12 @@ namespace HttpClient
|
|||||||
if urlTransfer = invalid
|
if urlTransfer = invalid
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
urlTransfer.EnableEncodings(true)
|
|
||||||
|
if COMPRESSION_ENABLED
|
||||||
|
' Enables gzip encoding of transfers
|
||||||
|
urlTransfer.EnableEncodings(true)
|
||||||
|
end if
|
||||||
|
|
||||||
urlTransfer.RetainBodyOnError(true)
|
urlTransfer.RetainBodyOnError(true)
|
||||||
if LCase(left(m._url, 6)).StartsWith("https:")
|
if LCase(left(m._url, 6)).StartsWith("https:")
|
||||||
urlTransfer.SetCertificatesFile("common:/certs/ca-bundle.crt")
|
urlTransfer.SetCertificatesFile("common:/certs/ca-bundle.crt")
|
||||||
|
|||||||
Reference in new issue
Block a user