Permalink
Browse files

Check unknown status codes too

  • Loading branch information...
1 parent 7ce9e11 commit eee30254c2ba314ad7fe3bc493095af421118c27 @rmccue committed Oct 25, 2012
Showing with 14 additions and 0 deletions.
  1. +14 −0 tests/Transport/Base.php
View
@@ -286,6 +286,20 @@ public function testStatusCodeThrowAllowRedirects($code, $success) {
$request->throw_for_status(true);
}
+ public function testStatusCodeUnknown(){
+ $request = Requests::get('http://httpbin.org/status/599', array(), $this->getOptions());
+ $this->assertEquals(599, $request->status_code);
+ $this->assertEquals(false, $request->success);
+ }
+
+ /**
+ * @expectedException Requests_Exception_HTTP_Unknown
+ */
+ public function testStatusCodeThrowUnknown(){
+ $request = Requests::get('http://httpbin.org/status/599', array(), $this->getOptions());
+ $request->throw_for_status(true);
+ }
+
public function testGzipped() {
$request = Requests::get('http://httpbin.org/gzip', array(), $this->getOptions());
$this->assertEquals(200, $request->status_code);

0 comments on commit eee3025

Please sign in to comment.