Skip to content

Commit d336c73

Browse files
committed
fix conversion for https requests
1 parent 126903c commit d336c73

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

Factory/HttpFoundationFactory.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ public function createRequest(ServerRequestInterface $psrRequest, bool $streamed
5252
$server['SERVER_PORT'] = $uri->getPort();
5353
$server['REQUEST_URI'] = $uri->getPath();
5454
$server['QUERY_STRING'] = $uri->getQuery();
55+
56+
if ('https' === $uri->getScheme()) {
57+
$server['HTTPS'] = 'on';
58+
}
5559
}
5660

5761
$server['REQUEST_METHOD'] = $psrRequest->getMethod();

Tests/Functional/CovertTest.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,24 @@ public function requestProvider()
139139
'Content'
140140
);
141141

142-
$psr7Request = (new Psr7Request('POST', 'http://tnyholm.se/foo/?bar=biz'))
143-
->withQueryParams(['bar' => 'biz']);
142+
$psr7Requests = [
143+
(new Psr7Request('POST', 'http://tnyholm.se/foo/?bar=biz'))
144+
->withQueryParams(['bar' => 'biz']),
145+
new Psr7Request('GET', 'https://hey-octave.com/'),
146+
new Psr7Request('GET', 'https://hey-octave.com:443/'),
147+
new Psr7Request('GET', 'https://hey-octave.com:4242/'),
148+
new Psr7Request('GET', 'http://hey-octave.com:80/'),
149+
];
144150

145151
$nyholmFactory = new Psr17Factory();
146152
$psr17Factory = new PsrHttpFactory($nyholmFactory, $nyholmFactory, $nyholmFactory, $nyholmFactory);
147153
$symfonyFactory = new HttpFoundationFactory();
148154

149-
return [
155+
return array_merge([
150156
[$sfRequest, $psr17Factory, $symfonyFactory],
151-
[$psr7Request, $symfonyFactory, $psr17Factory],
152-
];
157+
], array_map(function ($psr7Request) use ($symfonyFactory, $psr17Factory) {
158+
return [$psr7Request, $symfonyFactory, $psr17Factory];
159+
}, $psr7Requests));
153160
}
154161

155162
/**

0 commit comments

Comments
 (0)