Skip to content

Commit

Permalink
Corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
tyranron committed Nov 28, 2024
1 parent 246fdfd commit a665e77
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,28 @@ type HyperConnector = HttpsConnector<HttpConnector>;
/// The APNs service endpoint to send requests to.
///
/// Being appended with device token the notification
/// is sent to in `[endpoint]/[device_token]` format.
/// is sent to in a `[endpoint]/[device_token]` format.
#[derive(Debug, Clone)]
pub enum Endpoint {
/// Custom endpoint [`Uri`].
///
/// [`Uri::path`] should not contains trailing `/`.
/// [`Uri::path`] should not contain trailing `/`.
Custom(Uri),

/// The production environment (`https://api.push.apple.com/3/device`).
/// The production environment (`https://api.push.apple.com`).
Production,

/// The development/test environment
/// (`https://api.development.push.apple.com/3/device`).
/// (`https://api.development.push.apple.com`).
Sandbox,
}

impl fmt::Display for Endpoint {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Endpoint::Custom(uri) => write!(f, "{uri}"),
Endpoint::Production => write!(f, "https://api.push.apple.com/3/device"),
Endpoint::Sandbox => write!(f, "https://api.development.push.apple.com/3/device"),
Endpoint::Production => write!(f, "https://api.push.apple.com"),
Endpoint::Sandbox => write!(f, "https://api.development.push.apple.com"),
}
}
}
Expand Down Expand Up @@ -267,7 +267,7 @@ impl Client {
}

fn build_request<T: PayloadLike>(&self, payload: T) -> Result<hyper::Request<BoxBody<Bytes, Infallible>>, Error> {
let path = format!("{}/{}", self.options.endpoint, payload.get_device_token());
let path = format!("{}/3/device/{}", self.options.endpoint, payload.get_device_token());

let mut builder = hyper::Request::builder()
.uri(&path)
Expand Down

0 comments on commit a665e77

Please sign in to comment.