Skip to content

Commit

Permalink
fix: [#391] patch to identify 'torrent not found' tracker API response
Browse files Browse the repository at this point in the history
  • Loading branch information
josecelano committed Dec 26, 2023
1 parent 373493f commit 2c9c3dd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tracker/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ async fn map_torrent_info_response(response: Response) -> Result<TorrentInfo, Se
ServiceError::InternalServerError
})?;

if body == *"torrent not known" {
if body == "\"torrent not known\"" {
// todo: temporary fix. the service should return a 404 (StatusCode::NOT_FOUND).
return Err(ServiceError::TorrentNotFound);
}
Expand All @@ -209,7 +209,7 @@ mod tests {

#[tokio::test]
async fn it_should_return_a_torrent_not_found_response_when_the_tracker_returns_the_current_torrent_not_known_response() {
let tracker_response = Response::new("torrent not known");
let tracker_response = Response::new("\"torrent not known\"");

let result = map_torrent_info_response(tracker_response.into()).await.unwrap_err();

Expand Down

0 comments on commit 2c9c3dd

Please sign in to comment.