Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Messaging: Add check if HTTP/2 is supported #903

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/Firebase/Messaging/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,19 @@

$body = $this->streamFactory->createStream(Json::encode($payload));

return $request
->withProtocolVersion('2.0')
$request = $request

Check warning on line 46 in src/Firebase/Messaging/ApiClient.php

View check run for this annotation

Codecov / codecov/patch

src/Firebase/Messaging/ApiClient.php#L46

Added line #L46 was not covered by tests
->withBody($body)
->withHeader('Content-Type', 'application/json; charset=UTF-8')
->withHeader('Content-Length', (string) $body->getSize())
;

// @codeCoverageIgnoreStart
if (defined('CURL_HTTP_VERSION_2') || defined('CURL_HTTP_VERSION_2_0')) {
$request = $request->withProtocolVersion('2.0');
}
// @codeCoverageIgnoreEnd

return $request;

Check warning on line 58 in src/Firebase/Messaging/ApiClient.php

View check run for this annotation

Codecov / codecov/patch

src/Firebase/Messaging/ApiClient.php#L58

Added line #L58 was not covered by tests
}

/**
Expand Down