Skip to content
This repository was archived by the owner on Nov 6, 2021. It is now read-only.

Commit 6cf0a37

Browse files
authored
Merge pull request #12 from wakeapp/HUB-389
HUB-389
2 parents 9bfc65d + 6ceab0e commit 6cf0a37

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [2.0.12] - 2020-12-10
2+
### Changed
3+
- Headers from `ApiResponse` follow direct to client.
4+
15
## [2.0.11] - 2020-09-16
26
### Changed
37
- For `symfony/translation-contracts` added support of the `^2.2`.

EventListener/ApiResponseListener.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
use Psr\Log\LoggerAwareInterface;
1717
use Psr\Log\LoggerAwareTrait;
18-
use Symfony\Component\HttpKernel\Event\ResponseEvent;
1918
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
19+
use Symfony\Component\HttpKernel\Event\ResponseEvent;
2020
use Symfony\Component\OptionsResolver\Exception\ExceptionInterface;
2121
use Symfony\Contracts\Translation\TranslatorInterface;
2222
use Wakeapp\Bundle\ApiPlatformBundle\Dto\ApiDebugExceptionResultDto;
@@ -26,6 +26,7 @@
2626
use Wakeapp\Bundle\ApiPlatformBundle\Guesser\ApiErrorCodeGuesserInterface;
2727
use Wakeapp\Bundle\ApiPlatformBundle\HttpFoundation\ApiRequest;
2828
use Wakeapp\Bundle\ApiPlatformBundle\HttpFoundation\ApiResponse;
29+
2930
use function explode;
3031
use function sprintf;
3132

@@ -179,6 +180,8 @@ public function onKernelResponse(ResponseEvent $event): void
179180
'message' => $message,
180181
]);
181182

182-
$event->setResponse(new ApiResponse($resultDto));
183+
$headers = $response->headers->all();
184+
185+
$event->setResponse(new ApiResponse($resultDto, $headers));
183186
}
184187
}

0 commit comments

Comments
 (0)