diff --git a/src/AmoCRM.php b/src/AmoCRM.php index d2b38fd..0a7dbe0 100644 --- a/src/AmoCRM.php +++ b/src/AmoCRM.php @@ -35,7 +35,7 @@ class AmoCRM extends AbstractProvider * @var array */ public $headers = [ - 'User-Agent' => 'amoCRM/oAuth Client 1.0', + 'User-Agent' => 'amoCRM/oAuth Client 1.1', ]; /** @@ -45,8 +45,10 @@ class AmoCRM extends AbstractProvider */ public function __construct($options = [], $collaborators = []) { + $collaborators['optionProvider'] = new PostAuthOptionProvider(); parent::__construct($options, $collaborators); + if (isset($options['baseDomain'])) { $this->baseDomain = $options['baseDomain']; } diff --git a/src/PostAuthOptionProvider.php b/src/PostAuthOptionProvider.php new file mode 100644 index 0000000..1f1e6e2 --- /dev/null +++ b/src/PostAuthOptionProvider.php @@ -0,0 +1,26 @@ + ['Content-Type' => 'application/json']]; + + if ($method === AbstractProvider::METHOD_POST) { + $options['body'] = json_encode($params, JSON_UNESCAPED_SLASHES); + } + + return $options; + } +}