Browse Source

fix register verification response content negotiation

pull/7714/head
Tom 2 weeks ago
committed by Mathijs van Veluw
parent
commit
9f1c9f35c7
  1. 5
      src/api/identity.rs

5
src/api/identity.rs

@ -1086,10 +1086,9 @@ enum RegisterVerificationResponse {
PlainToken(String), PlainToken(String),
} }
// The iOS client sends `Accept: */*` and reads the raw body as its token, so it would end up with // Return JSON only when the client explicitly requests it, otherwise return plain text.
// the quotes of a JSON string. Every other client keeps the JSON string.
fn accepts_json(accept: Option<&Accept>) -> bool { fn accepts_json(accept: Option<&Accept>) -> bool {
accept.is_none_or(|accept| accept.preferred().media_type() != &MediaType::Any) accept.is_some_and(|accept| accept.preferred().media_type() == &MediaType::JSON)
} }
#[post("/accounts/register/send-verification-email", data = "<data>")] #[post("/accounts/register/send-verification-email", data = "<data>")]

Loading…
Cancel
Save