Tal Sofer
11/07/2021, 8:30 AMasync get(repoId, ref, path, additionalHeaders) {
const query = qs({path});
const response = await apiRequest(`/repositories/${repoId}/refs/${ref}/objects?${query}`, {
method: 'GET',
headers: new Headers(additionalHeaders)
});
if (response.status !== 200 && response.status !== 206) {
throw new Error(await extractError(response));
}
return response.text()
}
The promise it returns reads the object text from a stream and then returning. This get operation receives a Range header as a parameter and I need to track the response “Content-Range” to determine whether the full object content is returned or only part of it.
The problem i’m facing is how to return this information while the get function must return a promise because i’m invoking it with useAPI?
Can I somehow wrap the response.text(), response.headers.get("Content-Range")
with a promise?
@Barak Amar @Guy Hardonag @Ariel Shaqed (Scolnicov) maybe you have an advice?Barak Amar
Tal Sofer
11/09/2021, 7:51 AMAriel Shaqed (Scolnicov)
11/09/2021, 9:14 AMAriel Shaqed (Scolnicov)
11/09/2021, 9:15 AMAriel Shaqed (Scolnicov)
11/09/2021, 9:21 AMTal Sofer
11/09/2021, 11:10 AMTal Sofer
11/09/2021, 11:11 AMAriel Shaqed (Scolnicov)
11/09/2021, 12:57 PM