Decoding response body also takes time. This fact is reflected in API design of Response.text() in web fetch and reqwest.
In traditional game engine like UE FHttpModule, OnProcessRequestComplete is triggered only when full response (including body) is processed. Bevy, as a engine targeting high performance, should be able to achieve this in its API. The full processing can still be the default, we can provide an extra component to instruct bevy to do the correct and intended body processing (e.g. text/json::<T>).
The response event can accordingly be split into two:
RequestReceived: The response header received, which is await fetch() in JS and request.send() in reqwest.
RequestComplete: The response is fully processed, await response.text() and response.text().await
Questions need further pondering:
- The ambiguity in name:
RequestComplete follows the UE name, but the meaning of RequestReceived is not apparent.
- Should text and json be separate component?
Decoding response body also takes time. This fact is reflected in API design of
Response.text()in web fetch andreqwest.In traditional game engine like UE
FHttpModule,OnProcessRequestCompleteis triggered only when full response (including body) is processed. Bevy, as a engine targeting high performance, should be able to achieve this in its API. The full processing can still be the default, we can provide an extra component to instruct bevy to do the correct and intended body processing (e.g.text/json::<T>).The response event can accordingly be split into two:
RequestReceived: The response header received, which isawait fetch()in JS andrequest.send()inreqwest.RequestComplete: The response is fully processed,await response.text()andresponse.text().awaitQuestions need further pondering:
RequestCompletefollows the UE name, but the meaning ofRequestReceivedis not apparent.