On one side I have a remote Drupal 8 (8.8.1) served via HTTPS which has the following endpoint:
MODULENAME.get_notify: path: 'MODULENAME/get-notify' defaults: _controller: '\Drupal\MODULENAME\Controller\MODULENAMEApiController::get_notify' _title: 'Get notification' methods: [POST] requirements: _access: 'TRUE'
On the client side I have a Drupal 8 (8.8.2) served via HTTPS which sends a notification using Guzzle library. This Drupal is local to my machine and is served via DDEV. Here is the Guzzle petition which is located in a custom module:
$options = [ 'headers' => ['Content-Type' => 'application/json'], 'json' => $jsonArray, 'timeout' => 15, ]; $response = $this->httpClient->post($url, $options);
The system works well except that when running PHPUnit tests (BrowserTestBase) of the involved module the POST query always return the following error:
Client error: `POST https://SERVER_DOMAIN/MODULENAME/get-notify` resulted in a `403 Forbidden` response'
Any idea why I get this error message?