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


PHP RequestInterface::removeHeader方法代码示例

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


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

示例1: addContentLength

 private function addContentLength(RequestInterface $request, StreamInterface $body)
 {
     // Set the Content-Length header if it can be determined, and never
     // send a Transfer-Encoding: chunked and Content-Length header in
     // the same request.
     if ($request->hasHeader('Content-Length')) {
         // Remove transfer-encoding if content-length is set.
         $request->removeHeader('Transfer-Encoding');
         return;
     }
     if ($request->hasHeader('Transfer-Encoding')) {
         return;
     }
     if (null !== ($size = $body->getSize())) {
         $request->setHeader('Content-Length', $size);
         $request->removeHeader('Transfer-Encoding');
     } elseif ('1.1' == $request->getProtocolVersion()) {
         // Use chunked Transfer-Encoding if there is no determinable
         // content-length header and we're using HTTP/1.1.
         $request->setHeader('Transfer-Encoding', 'chunked');
         $request->removeHeader('Content-Length');
     }
 }
开发者ID:hexcode007,项目名称:yfcms,代码行数:23,代码来源:Prepare.php

示例2: signRequest

 public function signRequest(RequestInterface $request, CredentialsInterface $credentials)
 {
     // Ensure that the signable query string parameters are sorted
     sort($this->signableQueryString);
     // Add the security token header if one is being used by the credentials
     if ($token = $credentials->getSecurityToken()) {
         $request->setHeader('X-Amz-Security-Token', $token);
     }
     // Add a date header if one is not set
     $request->removeHeader('X-Amz-Date');
     $request->setHeader('Date', gmdate(\DateTime::RFC2822));
     $stringToSign = $this->createCanonicalizedString($request);
     $request->getConfig()['aws.signature'] = $stringToSign;
     $request->setHeader('Authorization', 'AWS ' . $credentials->getAccessKeyId() . ':' . $this->signString($stringToSign, $credentials));
 }
开发者ID:briareos,项目名称:aws-sdk-php,代码行数:15,代码来源:S3Signature.php

示例3: moveHeadersToQuery

 private function moveHeadersToQuery(RequestInterface $request)
 {
     $query = $request->getQuery();
     foreach ($request->getHeaders() as $name => $header) {
         $name = strtolower($name);
         if (substr($name, 0, 5) == 'x-amz') {
             $query[$name] = $header;
         }
         if ($name !== 'host') {
             $request->removeHeader($name);
         }
     }
 }
开发者ID:briareos,项目名称:aws-sdk-php,代码行数:13,代码来源:SignatureV4.php


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