Skip to content

Commit

Permalink
Revert "Throw an AuthenticationException for 401 status codes"
Browse files Browse the repository at this point in the history
  • Loading branch information
bkuhl authored Jan 2, 2020
1 parent 1cbe4e2 commit 651d606
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 121 deletions.
4 changes: 1 addition & 3 deletions src/Exception/AuthenticationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace HelpScout\Api\Exception;

use GuzzleHttp\Exception\RequestException;

class AuthenticationException extends RequestException implements Exception
class AuthenticationException extends \Exception implements Exception
{
}
27 changes: 0 additions & 27 deletions src/Http/Handlers/AuthenticationHandler.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Http/Handlers/ClientErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function __invoke(callable $handler)
return function (RequestInterface $request, array $options = []) use ($handler) {
return $handler($request, $options)->then(
function (ResponseInterface $response) use ($request) {
if ($response->getStatusCode() >= 400 && $response->getStatusCode() !== 401) {
if ($response->getStatusCode() >= 400) {
$e = RequestException::create($request, $response);

throw $e;
Expand Down
2 changes: 0 additions & 2 deletions src/Http/RestClientBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use HelpScout\Api\Http\Auth\LegacyCredentials;
use HelpScout\Api\Http\Auth\NullCredentials;
use HelpScout\Api\Http\Auth\RefreshCredentials;
use HelpScout\Api\Http\Handlers\AuthenticationHandler;
use HelpScout\Api\Http\Handlers\ClientErrorHandler;
use HelpScout\Api\Http\Handlers\RateLimitHandler;
use HelpScout\Api\Http\Handlers\ValidationHandler;
Expand Down Expand Up @@ -96,7 +95,6 @@ protected function getHandlerStack(): HandlerStack
{
$handler = HandlerStack::create();

$handler->push(new AuthenticationHandler());
$handler->push(new ClientErrorHandler());
$handler->push(new RateLimitHandler());
$handler->push(new ValidationHandler());
Expand Down
2 changes: 0 additions & 2 deletions tests/ApiClientIntegrationTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use GuzzleHttp\Psr7\Response;
use HelpScout\Api\ApiClient;
use HelpScout\Api\Http\Authenticator;
use HelpScout\Api\Http\Handlers\AuthenticationHandler;
use HelpScout\Api\Http\Handlers\ClientErrorHandler;
use HelpScout\Api\Http\Handlers\RateLimitHandler;
use HelpScout\Api\Http\Handlers\ValidationHandler;
Expand Down Expand Up @@ -49,7 +48,6 @@ public function setUp()
$handler = HandlerStack::create($this->mockHandler);

$handler->push(Middleware::history($this->history));
$handler->push(new AuthenticationHandler());
$handler->push(new ClientErrorHandler());
$handler->push(new RateLimitHandler());
$handler->push(new ValidationHandler());
Expand Down
20 changes: 0 additions & 20 deletions tests/Http/Handlers/AuthenticationHandlerTest.php

This file was deleted.

66 changes: 0 additions & 66 deletions tests/Http/Handlers/ClientHandlerTest.php

This file was deleted.

0 comments on commit 651d606

Please sign in to comment.