Пример #1
0
 /**
  * @param Client $client
  */
 protected function copyClientDefaults(Client $client)
 {
     $this->request->withUri(new Uri($client->getConfig('base_uri') . $this->request->getUri()));
     foreach ($client->getConfig('headers') as $header => $value) {
         $this->request->withAddedHeader($header, $value);
     }
 }
Пример #2
0
 /**
  * This method adds the current header parameters to the REST API request.
  *
  * @param Request $request
  * @return Request $request
  */
 public function apply(Request $request)
 {
     if ($this->replace) {
         return $request->withHeader($this->name, $this->value);
     } else {
         return $request->withAddedHeader($this->name, $this->value);
     }
 }