api_kit 0.2.0

Rust library for build typesafe web api client.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::rc::Rc;
use std::cell::RefCell;
use interceptor::{Interceptor, InterceptorChain};
use hyper::client::Response;
use error::ApiError;

pub struct LogInterceptor {
}

impl Interceptor for LogInterceptor {
    fn intercept(&self, chain: InterceptorChain) -> Result<Rc<RefCell<Response>>, ApiError> {
        let api_request = chain.request();
        println!("Uri: {}{}", api_request.base_url, api_request.path);
        return chain.proceed(api_request);
    }
}