aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2016-11-06 08:45:09 -0800
committerAustin Hellyer <[email protected]>2016-11-06 08:45:09 -0800
commitdb62348fc543c6c3dc18d0e5adefc0f138dd2fae (patch)
tree756b94a2895ec2f00a89492cb461277ceb979110 /src
parentFix doc import (diff)
downloadserenity-db62348fc543c6c3dc18d0e5adefc0f138dd2fae.tar.xz
serenity-db62348fc543c6c3dc18d0e5adefc0f138dd2fae.zip
Move HTTP/ratelimiting into a separate module
Diffstat (limited to 'src')
-rw-r--r--src/client/http/mod.rs (renamed from src/client/http.rs)6
-rw-r--r--src/client/http/ratelimiting.rs (renamed from src/client/ratelimiting.rs)3
-rw-r--r--src/client/mod.rs1
3 files changed, 5 insertions, 5 deletions
diff --git a/src/client/http.rs b/src/client/http/mod.rs
index fca8865..9ef9bac 100644
--- a/src/client/http.rs
+++ b/src/client/http/mod.rs
@@ -18,6 +18,8 @@
//!
//! [`Client`]: ../struct.Client.html
+mod ratelimiting;
+
use hyper::client::{
Client as HyperClient,
RequestBuilder,
@@ -28,11 +30,11 @@ use hyper::method::Method;
use hyper::status::StatusCode;
use hyper::{Error as HyperError, Result as HyperResult, Url, header};
use multipart::client::Multipart;
+use self::ratelimiting::Route;
use serde_json;
use std::default::Default;
use std::io::{ErrorKind as IoErrorKind, Read};
use std::sync::{Arc, Mutex};
-use super::ratelimiting::{self, Route};
use ::constants;
use ::model::*;
use ::prelude_internal::*;
@@ -48,7 +50,7 @@ pub fn set_token(token: &str) {
}
pub fn accept_invite(code: &str) -> Result<Invite> {
- let response = request!(Route::InvitesCode, post, "/invite/{}", code);
+ let response = request!(Route::InvitesCode, post, "/invites/{}", code);
Invite::decode(try!(serde_json::from_reader(response)))
}
diff --git a/src/client/ratelimiting.rs b/src/client/http/ratelimiting.rs
index 5690dbe..01e031a 100644
--- a/src/client/ratelimiting.rs
+++ b/src/client/http/ratelimiting.rs
@@ -6,7 +6,6 @@ use std::str;
use std::sync::{Arc, Mutex};
use std::thread;
use std::time::Duration;
-use super::http;
use time;
use ::prelude_internal::*;
@@ -126,7 +125,7 @@ pub fn perform<'a, F>(route: Route, f: F) -> Result<Response>
route.pre_hook();
}
- let response = try!(http::retry(&f));
+ let response = try!(super::retry(&f));
// Check if the request got ratelimited by checking for status 429,
// and if so, sleep for the value of the header 'retry-after' -
diff --git a/src/client/mod.rs b/src/client/mod.rs
index 7870e2e..c235177 100644
--- a/src/client/mod.rs
+++ b/src/client/mod.rs
@@ -40,7 +40,6 @@ mod context;
mod dispatch;
mod event_store;
mod login_type;
-mod ratelimiting;
pub use self::connection::{Connection, ConnectionError};
pub use self::context::Context;