当前位置: 首页>>代码示例>>PHP>>正文


PHP RequestInterface::setMethod方法代码示例

本文整理汇总了PHP中GuzzleHttp\Message\RequestInterface::setMethod方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestInterface::setMethod方法的具体用法?PHP RequestInterface::setMethod怎么用?PHP RequestInterface::setMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GuzzleHttp\Message\RequestInterface的用法示例。


在下文中一共展示了RequestInterface::setMethod方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: clientCall

 protected function clientCall($path, $method = 'GET', $data = array())
 {
     if ($this->request instanceof RequestInterface) {
         $this->request = $this->client->createRequest($method);
     }
     $this->request->setPath($path);
     $this->request->setMethod($method);
     $this->request->setQuery($data);
     if (isset($this->accessToken)) {
         $this->request->getQuery()->set('access_token', $this->accessToken);
     }
     $response = $this->client->send($this->request);
     return $response->json();
 }
开发者ID:gpascual,项目名称:deezer-sdk-php,代码行数:14,代码来源:DeezerClient.php

示例2: modifyRedirectRequest

 private function modifyRedirectRequest(RequestInterface $request, ResponseInterface $response)
 {
     $config = $request->getConfig();
     // Use a GET request if this is an entity enclosing request and we are
     // not forcing RFC compliance, but rather emulating what all browsers
     // would do.
     $statusCode = $response->getStatusCode();
     if ($statusCode == 303 || $statusCode <= 302 && $request->getBody() && !$config->getPath('redirect/strict')) {
         $request->setMethod('GET');
         $request->setBody(null);
     }
     $previousUrl = $request->getUrl();
     $this->setRedirectUrl($request, $response);
     $this->rewindEntityBody($request);
     // Add the Referer header if it is told to do so and only
     // add the header if we are not redirecting from https to http.
     if ($config->getPath('redirect/referer') && ($request->getScheme() == 'https' || $request->getScheme() == $config['redirect_scheme'])) {
         $url = Url::fromString($previousUrl);
         $url->setUsername(null);
         $url->setPassword(null);
         $request->setHeader('Referer', (string) $url);
     } else {
         $request->removeHeader('Referer');
     }
 }
开发者ID:bangordailynews,项目名称:bdnindex,代码行数:25,代码来源:Redirect.php

示例3: withMethod

 public function withMethod($method)
 {
     $this->expectedRequest->setMethod($method);
     return $this;
 }
开发者ID:lezhnev74,项目名称:GuzzleHttpMock,代码行数:5,代码来源:RequestExpectation.php


注:本文中的GuzzleHttp\Message\RequestInterface::setMethod方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。