You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I understand this is a feature request and questions should be posted in the Community Forum
I searched issues and couldn’t find anything (or linked relevant results below)
Problem
There are two problems.
xhr-upload has options getResponseData, getResponseError, and responseUrlFieldName to extract data for local files, these options are not used for responses from Companion as they are handled inside companion-client. Those options where introduced for people who want to convert XML to JSON (can't believe we support that 🙈). Funnily enough, those people with XML were never able to use Companion as Companion expects the response to be JSON before sending it over websockets. Besides that these options also feel awkward and could all be replaced with a single onAfterReponse.
Make onShouldRetry in tus-js-client support promises. At the moment when you want to refresh a token with tus you have to duplicate logic in onShouldRetry and onAfterResponse:
If onShouldRetry supports promises, we can put the await refreshAuthToken() before the return true and skip onAfterResponse.
Remove getResponseData, getResponseError, validateStatus, and responseUrlFieldName in favor of tus-style callbacks onBeforeRequest, onShouldRetry, and onAfterResponse, and optionally onError.
Alternatives
🤷
The text was updated successfully, but these errors were encountered:
Initial checklist
Problem
There are two problems.
getResponseData
,getResponseError
, andresponseUrlFieldName
to extract data for local files, these options are not used for responses from Companion as they are handled inside companion-client. Those options where introduced for people who want to convert XML to JSON (can't believe we support that 🙈). Funnily enough, those people with XML were never able to use Companion as Companion expects the response to be JSON before sending it over websockets. Besides that these options also feel awkward and could all be replaced with a singleonAfterReponse
.Solution
We need two changes.
onShouldRetry
intus-js-client
support promises. At the moment when you want to refresh a token with tus you have to duplicate logic inonShouldRetry
andonAfterResponse
:If
onShouldRetry
supports promises, we can put theawait refreshAuthToken()
before thereturn true
and skiponAfterResponse
.getResponseData
,getResponseError
,validateStatus
, andresponseUrlFieldName
in favor of tus-style callbacksonBeforeRequest
,onShouldRetry
, andonAfterResponse
, and optionallyonError
.Alternatives
🤷
The text was updated successfully, but these errors were encountered: