On the one hand, 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: 'DrupalMODULENAMEControllerMODULENAMEApiController::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 the Guzzle library. This Drupal is local on my machine and is served via DDEV. Here is the Guzzle petition which is in a personalized module:
$options = ( 'headers' => ('Content-Type' => 'application/json'), 'json' => $jsonArray, 'timeout' => 15, ); $response = $this->httpClient->post($url, $options);
The system works fine except that when running PHPUnit (BrowserTestBase) tests of the module concerned, the POST request always returns the following error:
Client error: `POST https://SERVER_DOMAIN/MODULENAME/get-notify` resulted in a `403 Forbidden` response'
Any idea why I am getting this error message?