mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 20:41:49 +00:00
add HttpResponse
This commit is contained in:
parent
fc877f09cb
commit
58c974a3a1
4 changed files with 108 additions and 63 deletions
|
|
@ -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)}
|
||||
));
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue