/** * {@inheritDoc} */ public function __invoke(RequestInterface $request, array $options) { $next = $this->nextHandler; if (!$this->config->has('access_token') || $this->config->get('access_token') === null) { return $next($request, $options); } $uri = Uri::withQueryValue($request->getUri(), 'access_token', $this->config->get('access_token')->getToken()); return parent::__invoke($request->withUri($uri)->withHeader('Content-Type', 'application/json'), $options); }
/** * {@inheritDoc} */ public function __invoke(RequestInterface $request, array $options) { $next = $this->nextHandler; if (!$this->config->get('secure_requests')) { return $next($request, $options); } $uri = $request->getUri(); $sig = $this->generateSig($this->getPath($uri), $this->getQueryParams($uri), $this->config->get('client_secret')); $uri = Uri::withQueryValue($uri, 'sig', $sig); return parent::__invoke($request->withUri($uri), $options); }