-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from donatj/feature/changableDefault
Adds Changeable Default Response
- Loading branch information
Showing
9 changed files
with
292 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace donatj\MockWebServer\Responses; | ||
|
||
use donatj\MockWebServer\MockWebServer; | ||
use donatj\MockWebServer\RequestInfo; | ||
use donatj\MockWebServer\ResponseInterface; | ||
|
||
/** | ||
* The Built-In Default Response. | ||
* Results in an HTTP 200 with a JSON encoded version of the incoming Request | ||
*/ | ||
class DefaultResponse implements ResponseInterface { | ||
|
||
public function getRef() { | ||
return md5(MockWebServer::VND . '.default-ref'); | ||
} | ||
|
||
public function getBody( RequestInfo $request ) { | ||
return json_encode($request, JSON_PRETTY_PRINT) . "\n"; | ||
} | ||
|
||
public function getHeaders( RequestInfo $request ) { | ||
return [ 'Content-Type' => 'application/json' ]; | ||
} | ||
|
||
public function getStatus( RequestInfo $request ) { | ||
return 200; | ||
} | ||
} |
Oops, something went wrong.