feat(doit): pre-request delegate call.

This one is likely to change the further we advance in the upload-media
implementation.
This commit is contained in:
Sebastian Thiel
2015-03-17 09:21:18 +01:00
parent eef1471357
commit 60adacf8d4
4 changed files with 146 additions and 0 deletions

View File

@@ -466,6 +466,9 @@ else {
}
let auth_header = hyper::header::Authorization(token.unwrap().access_token);
% endif
if ${delegate}.is_some() {
${delegate_call}.pre_request("${m.id}");
}
match ${client}.request(hyper::method::Method::Extension("${m.httpMethod}".to_string()), url.as_slice())
.header(hyper::header::UserAgent("google-api-rust-client/${cargo.build_version}".to_string()))
% if supports_scopes(auth):

View File

@@ -82,6 +82,10 @@ pub trait Delegate {
fn http_failure(&mut self, _: &hyper::client::Response, JsonServerError) -> oauth2::Retry {
oauth2::Retry::Abort
}
/// Called prior to sending the main request of the given method. It can be used to time
/// the call or to print progress information.
fn pre_request(&mut self, method_name: &str) { let _ = method_name; }
}
#[derive(Default)]