Beispiel #1
0
 /**
  * @covers WindowsAzure\Common\Internal\Http\Url::appendUrlPath
  */
 public function testAppendUrlPath()
 {
     // Setup
     $urlString = TestResources::VALID_URL;
     $expectedUrlPath = '/myqueue';
     $urlPath = 'myqueue';
     $url = new Url($urlString);
     // Test
     $url->appendUrlPath($urlPath);
     // Assert
     $this->assertEquals($expectedUrlPath, parse_url($url->getUrl(), PHP_URL_PATH));
 }
Beispiel #2
0
 /**
  * Sends HTTP request with the specified HTTP call context.
  * 
  * @param WindowsAzure\Common\Internal\Http\HttpCallContext $context The HTTP 
  * call context.
  * 
  * @return \HTTP_Request2_Response
  */
 protected function sendContext($context)
 {
     $channel = clone $this->_channel;
     $contextUrl = $context->getUri();
     $url = new Url(empty($contextUrl) ? $this->_uri : $contextUrl);
     $headers = $context->getHeaders();
     $statusCodes = $context->getStatusCodes();
     $body = $context->getBody();
     $queryParams = $context->getQueryParameters();
     $postParameters = $context->getPostParameters();
     $path = $context->getPath();
     $channel->setMethod($context->getMethod());
     $channel->setExpectedStatusCode($statusCodes);
     $channel->setBody($body);
     $channel->setHeaders($headers);
     if (count($postParameters) > 0) {
         $channel->setPostParameters($postParameters);
     }
     $url->setQueryVariables($queryParams);
     $url->appendUrlPath($path);
     $channel->send($this->_filters, $url);
     return $channel->getResponse();
 }