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


PHP RequestInterface::withAddedHeader方法代码示例

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


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

示例1:

 function its_middleware_adds_the_header_to_the_request(RequestIdentifierResolver $resolver, RequestInterface $request)
 {
     $identifier = StringRequestIdentifier::fromString('1234');
     $resolver->get()->shouldBeCalled()->willReturn($identifier);
     $request->withAddedHeader('X-Request-Id', '1234')->shouldBeCalled();
     $middlewareFactory = $this->create();
     $middleware = $middlewareFactory(function () {
     });
     $middleware($request, []);
 }
开发者ID:jakzal,项目名称:Tolerance,代码行数:10,代码来源:MiddlewareFactorySpec.php

示例2: withAddedHeader

 /**
  * @param string $header
  * @param string|\string[] $value
  * @return \Psr\Http\Message\MessageInterface
  */
 public function withAddedHeader($header, $value)
 {
     $this->request = $this->request->withAddedHeader($header, $value);
     return $this;
 }
开发者ID:bweston92,项目名称:expressive-async,代码行数:10,代码来源:ServerRequest.php

示例3: signRequest

 /**
  * Sign amazon request.
  *
  * @param RequestInterface $request
  * @param array            $packedCommands Headers generated based on request commands, see
  *                                         packCommands() method for more information.
  * @return RequestInterface
  */
 private function signRequest(RequestInterface $request, array $packedCommands = [])
 {
     $signature = [$request->getMethod(), $request->getHeaderLine('Content-MD5'), $request->getHeaderLine('Content-Type'), $request->getHeaderLine('Date')];
     $normalizedCommands = [];
     foreach ($packedCommands as $command => $value) {
         if (!empty($value)) {
             $normalizedCommands[] = strtolower($command) . ':' . $value;
         }
     }
     if ($normalizedCommands) {
         sort($normalizedCommands);
         $signature[] = join("\n", $normalizedCommands);
     }
     $signature[] = $request->getUri()->getPath();
     return $request->withAddedHeader('Authorization', 'AWS ' . $this->options['accessKey'] . ':' . base64_encode(hash_hmac('sha1', join("\n", $signature), $this->options['secretKey'], true)));
 }
开发者ID:jwdeitch,项目名称:components,代码行数:24,代码来源:AmazonServer.php

示例4: addAuthentificationInfo

 /**
  * @param RequestInterface $request
  *
  * @return RequestInterface
  */
 public function addAuthentificationInfo(RequestInterface $request)
 {
     return $request->withAddedHeader($this->header_name, $this->value);
 }
开发者ID:sc0rp10,项目名称:rest-client,代码行数:9,代码来源:HeaderProvider.php

示例5: withAddedHeader

 public function withAddedHeader($name, $value)
 {
     $new = clone $this;
     $new->request = $this->request->withAddedHeader($name, $value);
     return $new;
 }
开发者ID:deepfreeze,项目名称:zend-diactoros,代码行数:6,代码来源:Request.php


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