Skip to content

Commit 85fd7b4

Browse files
committed
Chore: bump utopia-php/http to 2.0.0-rc5
Adopt the PSR-compliant header API from utopia-php/http 2.0. - composer: bump utopia-php/http 0.34.* -> 2.0.0-rc5 (storage moves to 2.0.5 and telemetry to 0.4.0 to satisfy http 2.0's constraints); add minimum-stability RC + prefer-stable for the release candidate. - getHeader() now returns string[]; switch the request reads that expect a single string (accept, authorization, x-executor-response-format) to getHeaderLine(). - sendHeader() now takes array<int, string>; wrap the SSE log-stream header values accordingly. Verified: phpstan, pint, rector, unit (7/7), and e2e testExecute (28 assertions) + testLogStream (254 assertions) against a local stack.
1 parent 8c9c5ef commit 85fd7b4

3 files changed

Lines changed: 71 additions & 67 deletions

File tree

app/controllers.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
->action(function (string $runtimeId, string $timeoutStr, Response $response, Runner $runner): void {
2929
$timeout = \intval($timeoutStr);
3030

31-
$response->sendHeader('Content-Type', 'text/event-stream');
32-
$response->sendHeader('Cache-Control', 'no-cache');
31+
$response->sendHeader('Content-Type', ['text/event-stream']);
32+
$response->sendHeader('Cache-Control', ['no-cache']);
3333

3434
$runner->getLogs($runtimeId, $timeout, $response);
3535

@@ -234,7 +234,7 @@ function (
234234
);
235235

236236
// Backwards compatibility for headers
237-
$responseFormat = $request->getHeader('x-executor-response-format', '0.10.0'); // Last version without support for array value for headers
237+
$responseFormat = $request->getHeaderLine('x-executor-response-format', '0.10.0'); // Last version without support for array value for headers
238238
if (version_compare($responseFormat, '0.11.0', '<')) {
239239
foreach ($execution['headers'] as $key => $value) {
240240
if (\is_array($value)) {
@@ -244,7 +244,7 @@ function (
244244
}
245245
}
246246

247-
$acceptTypes = \explode(', ', $request->getHeader('accept', 'multipart/form-data'));
247+
$acceptTypes = \explode(', ', $request->getHeaderLine('accept', 'multipart/form-data'));
248248
$isJson = array_any($acceptTypes, fn ($acceptType): bool => \str_starts_with((string) $acceptType, 'application/json') || \str_starts_with((string) $acceptType, 'application/*'));
249249

250250
if ($isJson) {
@@ -284,7 +284,7 @@ function (
284284
->groups(['api'])
285285
->inject('request')
286286
->action(function (Request $request): void {
287-
$secretKey = \explode(' ', $request->getHeader('authorization', ''))[1] ?? '';
287+
$secretKey = \explode(' ', $request->getHeaderLine('authorization', ''))[1] ?? '';
288288
if ($secretKey === '' || $secretKey === '0' || $secretKey !== System::getEnv('OPR_EXECUTOR_SECRET', '')) {
289289
throw new Exception(Exception::GENERAL_UNAUTHORIZED, 'Missing executor key');
290290
}

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"description": "Serverless runtimes executor for container based environments ⚡️",
44
"type": "project",
55
"license": "MIT",
6+
"minimum-stability": "RC",
7+
"prefer-stable": true,
68
"autoload": {
79
"psr-4": {
810
"OpenRuntimes\\": "src/",
@@ -28,7 +30,7 @@
2830
"utopia-php/console": "^0.1.1",
2931
"utopia-php/di": "0.3.*",
3032
"utopia-php/dsn": "0.2.*",
31-
"utopia-php/http": "0.34.*",
33+
"utopia-php/http": "2.0.0-rc5",
3234
"utopia-php/orchestration": "^0.19.2",
3335
"utopia-php/storage": "^2.0",
3436
"utopia-php/system": "0.10.*"

0 commit comments

Comments
 (0)