Skip to content
This repository was archived by the owner on Jun 8, 2026. It is now read-only.

Commit 8acebd5

Browse files
authored
revert changes related to following redirects (#101)
Since all requests will be forwarded through nginx
1 parent dafd795 commit 8acebd5

2 files changed

Lines changed: 5 additions & 31 deletions

File tree

src/ClientBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function setClientSecret($clientSecret)
100100
*/
101101
public function setBaseUrl($baseUrl)
102102
{
103-
$this->baseUrl = RequestBuilder::getLastRedirectUrl(rtrim($baseUrl, '/') . '/');
103+
$this->baseUrl = rtrim($baseUrl, '/') . '/';
104104
return $this;
105105
}
106106

src/Transport/RequestBuilder.php

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Hitmeister\Component\Api\Transport;
44

55
use Hitmeister\Component\Api\Client;
6-
use Hitmeister\Component\Api\Exceptions\RuntimeException;
76

87
/**
98
* Class RequestBuilder
@@ -54,12 +53,10 @@ public function __construct($apiUrl = null)
5453
* @return string
5554
* @codeCoverageIgnore
5655
*/
57-
public static function defaultApiUrl()
58-
{
59-
$defaultApiUrl = 'https://www.real.de/api/v1/'; // trailing slash is required
60-
61-
return self::getLastRedirectUrl($defaultApiUrl);
62-
}
56+
public static function defaultApiUrl()
57+
{
58+
return 'https://www.real.de/api/v1/'; // trailing slash is required
59+
}
6360

6461
/**
6562
* @return string
@@ -108,27 +105,4 @@ public function build($method, $uri, $params = null)
108105

109106
return $request;
110107
}
111-
112-
/**
113-
* @param string $baseUrl
114-
*/
115-
public static function getLastRedirectUrl($baseUrl)
116-
{
117-
$ch = curl_init($baseUrl);
118-
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
119-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
120-
curl_setopt($ch, CURLOPT_HEADER, 1);
121-
curl_exec($ch);
122-
123-
$lastUrl = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
124-
125-
if (curl_error($ch)) {
126-
curl_close($ch);
127-
throw new RuntimeException('Couldn\'t redirect to final URL.');
128-
}
129-
130-
curl_close($ch);
131-
132-
return $lastUrl;
133-
}
134108
}

0 commit comments

Comments
 (0)