mirror of
https://github.com/Nutomic/ibis.git
synced 2024-11-29 05:41:09 +00:00
fix gloo post params
This commit is contained in:
parent
f022c56a69
commit
7f1ecd3e5c
1 changed files with 5 additions and 3 deletions
|
@ -286,11 +286,11 @@ impl ApiClient {
|
|||
});
|
||||
|
||||
let path_with_endpoint = self.request_endpoint(path);
|
||||
let params_encoded = serde_urlencoded::to_string(¶ms).unwrap();
|
||||
let path = if method == Method::GET {
|
||||
// Cannot pass the struct directly but need to convert it manually
|
||||
// https://github.com/rustwasm/gloo/issues/378
|
||||
let query = serde_urlencoded::to_string(¶ms).unwrap();
|
||||
format!("{path_with_endpoint}?{query}")
|
||||
format!("{path_with_endpoint}?{params_encoded}")
|
||||
} else {
|
||||
path_with_endpoint
|
||||
};
|
||||
|
@ -299,7 +299,9 @@ impl ApiClient {
|
|||
.abort_signal(abort_signal.as_ref())
|
||||
.credentials(RequestCredentials::Include);
|
||||
let req = if method == Method::POST {
|
||||
builder.json(¶ms)
|
||||
builder
|
||||
.header("content-type", "application/x-www-form-urlencoded")
|
||||
.body(params_encoded)
|
||||
} else {
|
||||
builder.build()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue