mirror of
https://codeberg.org/demostf/api-client.git
synced 2026-06-03 16:44:09 +02:00
fix hash
This commit is contained in:
parent
503dca9838
commit
be6a6e69ca
2 changed files with 4 additions and 4 deletions
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "demostf-client"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
authors = ["Robin Appelman <robin@icewind.nl>"]
|
||||
edition = "2018"
|
||||
description = "Api client for demos.tf"
|
||||
|
|
|
|||
|
|
@ -405,13 +405,13 @@ impl ApiClient {
|
|||
.await?)
|
||||
}
|
||||
|
||||
pub async fn set_url(&self, demo_id: u32, backend: &str, path: &str, url: &str, hash: &str, key: &str) -> Result<(), Error> {
|
||||
pub async fn set_url(&self, demo_id: u32, backend: &str, path: &str, url: &str, hash: [u8; 16], key: &str) -> Result<(), Error> {
|
||||
let mut api_url = self.base_url.clone();
|
||||
api_url.set_path(&format!("/demos/{}/url", demo_id));
|
||||
|
||||
let respose = self.client.post(api_url)
|
||||
.form(&[
|
||||
("hash", hash),
|
||||
("hash", hex::encode(hash).as_str()),
|
||||
("backend", backend),
|
||||
("url", url),
|
||||
("path", path),
|
||||
|
|
@ -487,7 +487,7 @@ mod tests {
|
|||
async fn test_set_url_invalid_key() {
|
||||
let client = ApiClient::default();
|
||||
|
||||
let res = client.set_url(9, "test", "test", "http://example.com/test", "dummy", "wrong").await;
|
||||
let res = client.set_url(9, "test", "test", "http://example.com/test", [0; 16], "wrong").await;
|
||||
assert!(matches!(res.unwrap_err(), Error::InvalidApiKey));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue