mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-02-23 15:49:49 +01:00
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:
@@ -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):
|
||||
|
||||
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user