add HttpResponse

This commit is contained in:
MihailRis 2026-09-13 16:16:59 +03:00
parent fc877f09cb
commit 58c974a3a1
4 changed files with 108 additions and 63 deletions

View file

@ -115,16 +115,24 @@ static int l_request(lua::State* L, network::Network& network) {
}
int currentRequestId = request_id++;
request.onResponse = [currentRequestId](std::vector<char> bytes) {
request.onResponse = [currentRequestId](network::HttpResponse response) {
push_event(NetworkEvent(
RESPONSE,
ResponseEventDto {200, false, currentRequestId, std::move(bytes)}
ResponseEventDto {
response.status,
false,
currentRequestId,
std::move(response.body)}
));
};
request.onReject = [currentRequestId](int code, std::vector<char> bytes) {
request.onReject = [currentRequestId](network::HttpResponse response) {
push_event(NetworkEvent(
RESPONSE,
ResponseEventDto {code, false, currentRequestId, std::move(bytes)}
ResponseEventDto {
response.status,
false,
currentRequestId,
std::move(response.body)}
));
};