Пример #1
0
 /**
  * @covers WindowsAzure\Common\Internal\Http\Url::setQueryVariables
  */
 public function testSetQueryVariables()
 {
     // Setup
     $urlString = TestResources::VALID_URL;
     $expectedQueryVariables = array(TestResources::HEADER1 => TestResources::HEADER1_VALUE, TestResources::HEADER2 => TestResources::HEADER2_VALUE);
     $url = new Url($urlString);
     // Test
     $url->setQueryVariables($expectedQueryVariables);
     // Assert
     $this->assertEquals($expectedQueryVariables, $url->getQueryVariables());
 }
Пример #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();
 }