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


PHP Request::receiveResponseHeader方法代码示例

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


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

示例1: testReceivingShortStatusLineResponse

 /**
  * Many RESTful frameworks omit the text status from the header. That
  * provides a response like "HTTP/1.1 200". Prevent an Undefined offset
  * by checking to see how many parts of the status line are provided
  * before trying to assign them.
  *
  * @covers Guzzle\Http\Message\Request::receiveResponseHeader
  */
 public function testReceivingShortStatusLineResponse()
 {
     $request = new Request('GET', $this->getServer()->getUrl());
     $request->receiveResponseHeader('HTTP/1.1 200');
     $this->assertSame(200, $request->getResponse()->getStatusCode());
     $this->assertSame('OK', $request->getResponse()->getReasonPhrase());
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:15,代码来源:RequestTest.php

示例2: testReceivingUnsuccessfulResponseUsesOtherResponseBody

 /**
  * Users sometimes want to use a custom stream when receiving a response body.
  * Because of the various potential for retrying failed requests, the stream
  * specified by the user should only be written to in the event that a
  * successful response was received.  Otherwise, a new temp stream is created
  * to store the body of the failed request.
  *
  * @covers Guzzle\Http\Message\Request::receiveResponseHeader
  */
 public function testReceivingUnsuccessfulResponseUsesOtherResponseBody()
 {
     $request = new Request('GET', $this->getServer()->getUrl());
     $body = EntityBody::factory();
     $request->setResponseBody($body);
     $request->receiveResponseHeader('HTTP/1.1 503 Service Unavailable');
     $this->assertNotSame($body, $request->getResponse()->getBody());
 }
开发者ID:nickpeirson,项目名称:guzzle,代码行数:17,代码来源:RequestTest.php


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