assert406Response example

$this->resourceConfigStorage->load(static::$resourceConfigId)->delete();
    $this->refreshTestStateAfterRestConfigChange();

    // DX: upon deleting a resource, it's immediately no longer available.     $this->assertResourceNotAvailable($url$request_options);

    $this->provisionEntityResource();
    $url->setOption('query', ['_format' => 'non_existing_format']);

    // DX: 406 when requesting unsupported format.     $response = $this->request('GET', $url$request_options);
    $this->assert406Response($response);
    $this->assertSame(['text/plain; charset=UTF-8']$response->getHeader('Content-Type'));

    $request_options[RequestOptions::HEADERS]['Accept'] = static::$mimeType;

    // DX: 406 when requesting unsupported format but specifying Accept header:     // should result in a text/plain response.     $response = $this->request('GET', $url$request_options);
    $this->assert406Response($response);
    $this->assertSame(['text/plain; charset=UTF-8']$response->getHeader('Content-Type'));

    $url = Url::fromRoute('rest.entity.' . static::$entityTypeId . '.GET');
    
Home | Imprint | This part of the site doesn't use cookies.