You are here

public function ResponseHeadersTest::testResponseHeaders in JSON-RPC 2.x

Tests enabling the maintenance mode.

File

tests/src/Functional/ResponseHeadersTest.php, line 36

Class

ResponseHeadersTest
Test turning the maintenance mode on or off using JSON RPC.

Namespace

Drupal\Tests\jsonrpc\Functional

Code

public function testResponseHeaders() {
  $batch_request = [
    [
      'jsonrpc' => '2.0',
      'method' => 'second.test',
      'id' => 'second',
    ],
    [
      'jsonrpc' => '2.0',
      'method' => 'first.test',
      'id' => 'first',
    ],
  ];
  $response = $this
    ->postRpc($batch_request);
  $this
    ->assertSame('oof', $response
    ->getHeader('foo')[0]);
  $this
    ->assertSame('', $response
    ->getHeader('hello')[0]);
  $this
    ->assertEmpty($response
    ->getHeader('lorem'));
  $this
    ->assertEmpty($response
    ->getHeader('bye'));
}