/**
  * @param callable $handler
  *
  * @return \Closure
  */
 public function __invoke(callable $handler)
 {
     return function (RequestInterface $request, array $options) use(&$handler) {
         $url = rawurldecode(str_replace($this->appContext, "", $request->getUri()));
         $this->auth->setQueryString($request->getMethod(), $url);
         $request = $this->appendHeaders($request);
         $request = $this->appendQueryParams($request);
         return $handler($request, $options);
     };
 }