When posting a request to the service using below sample code, response has proper headers and body.
response = await ky.post("test.aspx", {}).catch();
But for some reason, request is getting timing out. So, with the intention to log on first first arrival, started using onDownloadProgress event as given below.
response = await ky.post("test.aspx", {
onDownloadProgress: (progress: DownloadProgress, _chunk: Uint8Array /* ignored */) => {
downloadProgressValue = progress.percent;
downloadChunkLength = progress.transferredBytes;**
}
})
.then(async response =>
{
await response.arraybuffer();
return response;
}
)
.catch(() => {});
Now, When I try to access response.header.get("headerkey"), there is nothing set.
Any idea, if onDownloadProgress even corrupts the response or Am I using it wrong?
Note, without await response.arraybuffer() in .then, control is returned to caller immediately after first hit of onDownloadProgress. So, added the await in then to make sure entire stream is downloaded before returning control to caller.