Skip to content

Commit

Permalink
Optimization for redirect response
Browse files Browse the repository at this point in the history
  • Loading branch information
twose committed May 7, 2020
1 parent 4de3269 commit 067c408
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace Swlib\Saber;

use Swlib\Http\BufferStream;
use Swlib\Http\CookiesManagerTrait;
use Swlib\Http\Exception\BadResponseException;
use Swlib\Http\Exception\ClientException;
Expand All @@ -18,7 +17,6 @@
use Swlib\Http\StreamInterface;
use Swlib\Util\StringDataParserTrait;
use Swlib\Util\SpecialMarkTrait;
use Swlib\Http\Status;
use function Swlib\Http\stream_for;

class Response extends \Swlib\Http\Response
Expand Down Expand Up @@ -67,7 +65,7 @@ function __construct(Request $request)
// enable auto iconv
if ($request->charset_source && strcasecmp($request->charset_source, 'auto') !== 0) {
$charset_source = $request->charset_source;
} elseif (
} /** @noinspection PhpStatementHasEmptyBodyInspection */ elseif (
($contentType = $request->client->headers['content-type'] ?? '') &&
($charset_source = explode('=', $contentType)[1] ?? null)
) {
Expand Down Expand Up @@ -111,7 +109,8 @@ function __construct(Request $request)
$this->success = true;
break;
case 3:
if ($this->statusCode === Status::NOT_MODIFIED) {
if (!$this->hasHeader('Location')) {
/* not a redirect response */
$this->success = true;
break;
}
Expand Down

0 comments on commit 067c408

Please sign in to comment.