1
0
mirror of https://github.com/vbrandl/bind9-api.git synced 2024-11-22 10:03:50 +01:00

Move hyper dependency to the client

This commit is contained in:
Valentin Brandl 2018-07-08 20:28:32 +02:00
parent 84c79ce9b4
commit 6eacab00f9
Signed by: vbrandl
GPG Key ID: CAD4DA1A789125F9

View File

@ -45,6 +45,8 @@ extern crate crypto;
extern crate data; extern crate data;
extern crate failure; extern crate failure;
#[macro_use] #[macro_use]
extern crate hyper;
#[macro_use]
extern crate log; extern crate log;
extern crate openssl_probe; extern crate openssl_probe;
extern crate pretty_env_logger; extern crate pretty_env_logger;
@ -65,6 +67,8 @@ use std::borrow::Cow;
type Result<T> = std::result::Result<T, Error>; type Result<T> = std::result::Result<T, Error>;
header! { (XApiToken, data::TOKEN_HEADER) => [String] }
#[derive(Eq, PartialEq, Clone, Copy)] #[derive(Eq, PartialEq, Clone, Copy)]
enum Method { enum Method {
POST, POST,
@ -114,7 +118,7 @@ fn call_api<D: serde::Serialize>(
client.post(&url) client.post(&url)
} else { } else {
client.delete(&url) client.delete(&url)
}.header(data::XApiToken(signature)) }.header(XApiToken(signature))
.json(&data) .json(&data)
.send()?) .send()?)
} }