Skip to content

Commit

Permalink
pass github's response
Browse files Browse the repository at this point in the history
  • Loading branch information
subhojit777 committed Mar 4, 2019
1 parent d1407c4 commit 8d6e924
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/answers.rs
Expand Up @@ -34,9 +34,7 @@ pub fn post(
.responder()
}

pub fn get<'a>(
req: HttpRequest<AppState>,
) -> Box<Future<Item = HttpResponse, Error = AWError::Error>> {
pub fn get(req: HttpRequest<AppState>) -> Box<Future<Item = HttpResponse, Error = AWError::Error>> {
let header_map: HeaderMapWrapper = HeaderMapWrapper {
map: req.headers().clone(),
};
Expand All @@ -50,7 +48,13 @@ pub fn get<'a>(
.unwrap()
.send()
.from_err()
.and_then(|res: ClientResponse| Ok(HttpResponse::Ok().body("answers get")))
.and_then(|res: ClientResponse| {
if res.status() == 200 {
return Ok(HttpResponse::Ok().body("answers get"));
}

Ok(HttpResponse::Forbidden().into())
})
})
.responder()
}
Expand Down

0 comments on commit 8d6e924

Please sign in to comment.