This commit is contained in:
MihailRis 2026-09-10 20:38:50 +03:00
parent 9226f362a7
commit 946728e54e
3 changed files with 28 additions and 2 deletions

View file

@ -111,6 +111,19 @@ static int l_request(lua::State* L, network::Network& network) {
}
int currentRequestId = request_id++;
request.onResponse = [currentRequestId](std::vector<char> bytes) {
push_event(NetworkEvent(
RESPONSE,
ResponseEventDto {200, false, currentRequestId, std::move(bytes)}
));
};
request.onReject = [currentRequestId](int code, std::vector<char> bytes) {
push_event(NetworkEvent(
RESPONSE,
ResponseEventDto {code, false, currentRequestId, std::move(bytes)}
));
};
network.request(std::move(request));
return lua::pushinteger(L, currentRequestId);
}