Getting different error response for endpoints