Skip to content

Commit

Permalink
feat: treat non HTTP 2xx responses as exceptional
Browse files Browse the repository at this point in the history
  • Loading branch information
booniepepper committed Oct 5, 2023
1 parent 8d43b08 commit a84a576
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,10 @@ private static void checkStatus(String name, HttpResponse<String> response, Thro
case HttpURLConnection.HTTP_INTERNAL_ERROR:
throw new FgaApiInternalError(name, previousError, status, response.headers(), body);
}

// FGA and OAuth2 servers are only expected to return HTTP 2xx responses.
if (status < 200 || 300 <= status) {
throw new ApiException(name, previousError, status, response.headers(), body);
}
}
}

0 comments on commit a84a576

Please sign in to comment.