Ejemplo n.º 1
0
 /**
  * @param \Guzzle\Http\Message\Request $request
  */
 public function signRequest(Request $request)
 {
     $requestWrapper = new RequestWrapper($request);
     if (!$request->hasHeader('Date')) {
         $time = new \DateTime();
         $time->setTimezone(new \DateTimeZone('GMT'));
         $request->setHeader('Date', $time->format(ClientInterface::HTTP_DATE));
     }
     if (!$request->hasHeader('Content-Type')) {
         $request->setHeader('Content-Type', $this->defaultContentType);
     }
     $authorization = $this->requestSigner->getAuthorization($requestWrapper, $this->id, $this->secretKey);
     $request->setHeader('Authorization', $authorization);
 }
Ejemplo n.º 2
0
 /**
  * @covers Guzzle\Http\Message\Request::__construct
  */
 public function testConstructorBuildsRequestWithNoHeaders()
 {
     $request = new Request('GET', 'http://www.guzzle-project.com/', null);
     $this->assertFalse($request->hasHeader('foo'));
 }
Ejemplo n.º 3
0
 /**
  * {@inheritDoc}
  */
 public function hasHeader($header)
 {
     return $this->request->hasHeader($header);
 }