Skip to content

Commit

Permalink
- Fix Proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinichi69 committed Sep 30, 2021
1 parent d41bf29 commit 8df0e66
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Controller/Proxy/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ public function execute()
}

$response = $this->helperEmailMarketing->sendRequestProxy($url, $params);
if ($this->_request->getParam('type') === 'raw') {
if (isset($params['type'])) {
$result = $this->resultRawFactory->create();
$result->setHeader('content-type', $params['type']);
$result->setContents($response);

return $result;
Expand Down
8 changes: 5 additions & 3 deletions Helper/EmailMarketing.php
Original file line number Diff line number Diff line change
Expand Up @@ -1688,6 +1688,8 @@ public function isTracking($storeId = null)
*/
public function sendRequestProxy($url, $data)
{
$params = $this->_request->getParams();

$this->initCurl();

if ($this->_request->getMethod() === 'POST') {
Expand All @@ -1697,9 +1699,9 @@ public function sendRequestProxy($url, $data)
$this->_curl->get($url);
}

$body = $this->_curl->getBody();
$bodyData = self::jsonDecode($body);
if ($this->_request->getParam('type') === 'raw') {
$body = $this->_curl->getBody();
$bodyData = self::jsonDecode($body);
if (isset($params['type'])) {
$bodyData = $body;
}

Expand Down

0 comments on commit 8df0e66

Please sign in to comment.