| @@ 71-78 (lines=8) @@ | ||
| 68 | * |
|
| 69 | * @throws CentrifugoException |
|
| 70 | */ |
|
| 71 | public function assertValidResponseHeaders(ResponseInterface $response): void |
|
| 72 | { |
|
| 73 | $headers = $response->getHeaders(false); |
|
| 74 | ||
| 75 | if (!isset($headers['content-type'])) { |
|
| 76 | throw new CentrifugoException('Missing "content-type" header in Centrifugo response'); |
|
| 77 | } |
|
| 78 | } |
|
| 79 | ||
| 80 | /** |
|
| 81 | * @param ResponseInterface $response |
|
| @@ 85-92 (lines=8) @@ | ||
| 82 | * |
|
| 83 | * @throws CentrifugoException |
|
| 84 | */ |
|
| 85 | public function assertValidResponseContentType(ResponseInterface $response): void |
|
| 86 | { |
|
| 87 | $headers = $response->getHeaders(false); |
|
| 88 | ||
| 89 | if (!\in_array('application/json', $headers['content-type'], true)) { |
|
| 90 | throw new CentrifugoException('Unexpected content type for Centrifugo response'); |
|
| 91 | } |
|
| 92 | } |
|
| 93 | } |
|
| 94 | ||