소스 검색

better handling of json parse errors

master
Jonathan Cobb 4 년 전
부모
커밋
416feedf83
1개의 변경된 파일10개의 추가작업 그리고 4개의 파일을 삭제
  1. +10
    -4
      src/proxy.rs

+ 10
- 4
src/proxy.rs 파일 보기

@@ -127,10 +127,16 @@ async fn proxy(client: Client<HttpsConnector<HttpConnector<CacheResolver>>>,
return bad_request("auth not found");
}

let auth : Ping = serde_json::from_str(flex_auth.unwrap().to_string().as_str()).unwrap();
if !auth.verify(auth_token.clone()) {
error!("proxy: invalid auth");
return bad_request("invalid auth");
let auth_result = serde_json::from_str(flex_auth.unwrap().to_string().as_str());
if auth_result.is_err() {
error!("proxy: error parsing auth: {:?}", auth_result.err());
return bad_request("error parsing auth");
} else {
let auth: Ping = auth_result.unwrap();
if !auth.verify(auth_token.clone()) {
error!("proxy: invalid auth");
return bad_request("invalid auth");
}
}

let host = host.unwrap();


불러오는 중...
취소
저장