Fix building the HTTP feature on Wasm ()

This commit is contained in:
Rushmore Mushambi 2023-05-05 20:14:36 +02:00 committed by GitHub
parent fb6f1caa6b
commit 3dd0b6d5e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 7 deletions
.github/workflows
lib/src/fnc/util/http

View file

@ -63,7 +63,7 @@ jobs:
uses: actions/checkout@v3
- name: Run cargo check
run: cargo check --locked --package surrealdb --features protocol-ws,protocol-http,kv-mem,kv-indxdb --target wasm32-unknown-unknown
run: cargo check --locked --package surrealdb --features protocol-ws,protocol-http,kv-mem,kv-indxdb,http --target wasm32-unknown-unknown
clippy:
name: Check clippy

View file

@ -26,8 +26,9 @@ pub async fn head(ctx: &Context<'_>, uri: Strand, opts: impl Into<Object>) -> Re
}
// Send the request and wait
let res = match ctx.timeout() {
#[cfg(not(target_arch = "wasm32"))]
Some(d) => req.timeout(d).send().await?,
None => req.send().await?,
_ => req.send().await?,
};
// Check the response status
match res.status() {
@ -51,8 +52,9 @@ pub async fn get(ctx: &Context<'_>, uri: Strand, opts: impl Into<Object>) -> Res
}
// Send the request and wait
let res = match ctx.timeout() {
#[cfg(not(target_arch = "wasm32"))]
Some(d) => req.timeout(d).send().await?,
None => req.send().await?,
_ => req.send().await?,
};
// Check the response status
match res.status() {
@ -100,8 +102,9 @@ pub async fn put(
}
// Send the request and wait
let res = match ctx.timeout() {
#[cfg(not(target_arch = "wasm32"))]
Some(d) => req.timeout(d).send().await?,
None => req.send().await?,
_ => req.send().await?,
};
// Check the response status
match res.status() {
@ -149,8 +152,9 @@ pub async fn post(
}
// Send the request and wait
let res = match ctx.timeout() {
#[cfg(not(target_arch = "wasm32"))]
Some(d) => req.timeout(d).send().await?,
None => req.send().await?,
_ => req.send().await?,
};
// Check the response status
match res.status() {
@ -198,8 +202,9 @@ pub async fn patch(
}
// Send the request and wait
let res = match ctx.timeout() {
#[cfg(not(target_arch = "wasm32"))]
Some(d) => req.timeout(d).send().await?,
None => req.send().await?,
_ => req.send().await?,
};
// Check the response status
match res.status() {
@ -242,8 +247,9 @@ pub async fn delete(
}
// Send the request and wait
let res = match ctx.timeout() {
#[cfg(not(target_arch = "wasm32"))]
Some(d) => req.timeout(d).send().await?,
None => req.send().await?,
_ => req.send().await?,
};
// Check the response status
match res.status() {