Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dmsrc/http.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
#define RUSTG_HTTP_METHOD_POST "post"
#define rustg_http_request_blocking(method, url, body, headers, options) RUSTG_CALL(RUST_G, "http_request_blocking")(method, url, body, headers, options)
#define rustg_http_request_async(method, url, body, headers, options) RUSTG_CALL(RUST_G, "http_request_async")(method, url, body, headers, options)
#define rustg_http_request_fire_and_forget(method, url, body, headers, options) RUSTG_CALL(RUST_G, "http_request_fire_and_forget")(method, url, body, headers, options)
#define rustg_http_check_request(req_id) RUSTG_CALL(RUST_G, "http_check_request")(req_id)
10 changes: 10 additions & 0 deletions src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ byond_fn!(fn http_request_async(method, url, body, headers, options) {
}))
});

byond_fn!(fn http_request_fire_and_forget(method, url, body, headers, options) {
let req = match construct_request(method, url, body, headers, options) {
Ok(r) => r,
Err(e) => return Some(e.to_string())
};

std::thread::spawn(move || req.req.send_bytes(&req.body));
Some("ok".to_owned())
});

// If the response can be deserialized -> success.
// If the response can't be deserialized -> failure or WIP.
byond_fn!(fn http_check_request(id) {
Expand Down
Loading