Fix bug with requests not sent

This commit is contained in:
Brahim Hadriche committed 2023-11-10 17:34:31 -05:00
1 parent 3c43934081
commit 665fa44a49
4 files changed
+6 -3

No files matched your search

@@ -88,7 +88,7 @@ namespace Invidious
url = `${authToken.instance}${Invidious.HISTORY_ENDPOINT}/${videoId}`
request = HttpClient.Post(url, "")
request.Headers(m.GetAuthenticationHeaders(authToken.token))
request.Send()
request.Await()
end function
function SearchSuggestions(q as string, cancellation = invalid as object) as object
@@ -482,7 +482,7 @@ namespace Invidious
request.Headers(m.GetAuthenticationHeaders(authToken.token))
request.Header("Content-Type", "application/json")
request.Send()
request.Await()
end function
function GetAuthorizeTokenLink() as dynamic
@@ -84,7 +84,7 @@ namespace SponsorBlock
end if
url = `${m.sponsorBlockConfig.serverAddress}${SponsorBlock.VIEWED_SEGMENT_ENDPOINT}?UUID=${segmentId}`
HttpClient.Post(url, "").Send()
HttpClient.Post(url, "").Await()
end function
function GenerateProgressBarBackground(segments as object, lengthSeconds as integer, path as string)
@@ -202,6 +202,8 @@ namespace HttpClient
return command
end function
' Note: Calling Send() only without Await() will not guarentee a request will be sent.
' If a Task finishes before the request is sent, the request might be dropped.
function Send() as HttpRequest
if m.urlTransfer <> invalid or m._cache <> invalid
return m