Skip to content

Commit

Permalink
[BUGFIX] using preg_grep because Contents will be an array (#10308)
Browse files Browse the repository at this point in the history
Co-authored-by: Ruth Cheesley <ruth.cheesley@acquia.com>
Co-authored-by: Dennis Ameling (he/him) <dennis@dennisameling.com>
  • Loading branch information
3 people committed Nov 10, 2021
1 parent 4b66097 commit 8f3c58b
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ public function onResponse(PluginIntegrationRequestEvent $event)
$response = $event->getResponse();
$headers = var_export($response->getHeaders(), true);
$name = strtoupper($event->getIntegrationName());
$isJson = isset($response->getHeaders()['Content-Type']) && preg_match('/application\/json/', $response->getHeaders()['Content-Type']);
$isJson = isset($response->getHeaders()['Content-Type']) && preg_grep('/application\/json/', $response->getHeaders()['Content-Type']);
$json = $isJson ? str_replace(' ', ' ', json_encode(json_decode($response->getBody()), JSON_PRETTY_PRINT)) : '';
$xml = '';
$isXml = isset($response->getHeaders()['Content-Type']) && preg_match('/text\/xml/', $response->getHeaders()['Content-Type']);
$isXml = isset($response->getHeaders()['Content-Type']) && preg_grep('/text\/xml/', $response->getHeaders()['Content-Type']);
if ($isXml) {
$doc = new DomDocument('1.0');
$doc->preserveWhiteSpace = false;
Expand Down

0 comments on commit 8f3c58b

Please sign in to comment.