diff options
| author | Zeyla Hellyer <[email protected]> | 2018-08-04 21:30:08 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2018-08-04 21:30:08 -0700 |
| commit | a0b0dd226f9ad2476729fa79dbc680bd08aa44b3 (patch) | |
| tree | ac4b45b1c629c8149e74dfdf762f1543cefb9321 /src/internal | |
| parent | Maintain a single, re-used HTTP client (diff) | |
| download | serenity-a0b0dd226f9ad2476729fa79dbc680bd08aa44b3.tar.xz serenity-a0b0dd226f9ad2476729fa79dbc680bd08aa44b3.zip | |
Redo how requests are formed in HTTP module
Instead of passing around a function that builds an HTTP client request builder,
pass around a struct that contains the necessary information _to_ build that
request builder.
Additionally, instead of using a macro to generate requests, just call a request
function. This saves some required code expansion and is just easier to read
and maintain.
Diffstat (limited to 'src/internal')
| -rw-r--r-- | src/internal/macros.rs | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/src/internal/macros.rs b/src/internal/macros.rs index 6d82704..31b6b7d 100644 --- a/src/internal/macros.rs +++ b/src/internal/macros.rs @@ -1,28 +1,6 @@ //! A set of macros for easily working with internals. #[cfg(feature = "http")] -macro_rules! request { - ($route:expr, $method:ident($body:expr), $url:expr, $($rest:tt)*) => {{ - request($route, || CLIENT - .$method(&format!(api!($url), $($rest)*)) - .body(&$body))? - }}; - ($route:expr, $method:ident($body:expr), $url:expr) => {{ - request($route, || CLIENT - .$method(api!($url)) - .body(&$body))? - }}; - ($route:expr, $method:ident, $url:expr, $($rest:tt)*) => {{ - request($route, || CLIENT - .$method(&format!(api!($url), $($rest)*)))? - }}; - ($route:expr, $method:ident, $url:expr) => {{ - request($route, || CLIENT - .$method(api!($url)))? - }}; -} - -#[cfg(feature = "http")] macro_rules! request_client { () => {{ use hyper::net::HttpsConnector; |