Skip to content

Commit

Permalink
Fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Jontified committed Oct 16, 2023
1 parent d44857a commit aee7586
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions mullvad-api/src/rest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,18 +394,15 @@ impl From<Request> for RestRequest {
}

#[derive(serde::Deserialize)]
pub struct OldErrorResponse {
struct OldErrorResponse {
pub code: String,
}

/// If `NewErrorResponse::type` is not defined it should default to "about:blank"
const DEFAULT_ERROR_TYPE: &str = "about:blank";
#[derive(serde::Deserialize)]
pub struct NewErrorResponse {
pub status: i32,
pub title: String,
struct NewErrorResponse {
pub r#type: Option<String>,
pub detail: Option<String>,
}

#[derive(Clone)]
Expand Down Expand Up @@ -612,6 +609,9 @@ pub async fn handle_error_response<T>(response: Response) -> Result<T> {
body_length => {
return match response.headers().get("content-type") {
Some(content_type) if content_type == "application/problem+json" => {
// TODO: We should make sure we unify the new error format and the old
// error format so that they both produce the same Errors for the same
// problems after being processed.
let err: NewErrorResponse =
deserialize_body_inner(response, body_length).await?;
// The new error type replaces the `code` field with the `type` field.
Expand Down
2 changes: 1 addition & 1 deletion mullvad-types/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub type AccessToken = String;
/// The payment token returned by initiating a google play purchase.
/// In the API this is called the `obfuscated_id`.
#[cfg(target_os = "android")]
pub type PlayPurchasePaymentToken = String;
pub type PlayPurchasePaymentToken = PlayPurchasePaymentToken;

/// Account expiration info returned by the API via `/v1/me`.
#[derive(Debug, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)]
Expand Down

0 comments on commit aee7586

Please sign in to comment.