Skip to content
This repository has been archived by the owner on Sep 19, 2018. It is now read-only.

Commit

Permalink
If a resource return non html, Orchestra\Resources\Response should re…
Browse files Browse the repository at this point in the history
…spect that instead of rebuild as html. Closes #5.

Signed-off-by: crynobone <crynobone@gmail.com>
  • Loading branch information
crynobone committed Jun 8, 2013
1 parent 4b40d42 commit a3f4c19
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Orchestra/Resources/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function call($content, Closure $callback = null)
}
elseif ( ! is_null($contentType) and ! $isHtml)
{
return $response;
return $content;
}
elseif ( ! $content->isSuccessful())
{
Expand Down
4 changes: 2 additions & 2 deletions tests/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ public function testCallMethodWhenGivenIlluminateResponse()
$content->shouldReceive('getStatusCode')->once()->andReturn(200)
->shouldReceive('getContent')->once()->andReturn('foo')
->shouldReceive('isSuccessful')->never()->andReturn(true);
$headers->shouldReceive('get')->with('Content-Type')->once()->andReturn('text/json');
$this->assertEquals('foo', $stub->call($content));
$headers->shouldReceive('get')->with('Content-Type')->once()->andReturn('application/json');
$this->assertEquals($content, $stub->call($content));

$content = m::mock('\Illuminate\Http\Response');
$content->headers = $headers = m::mock('HeaderBag');
Expand Down

0 comments on commit a3f4c19

Please sign in to comment.