-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
2,984 additions
and
892 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,32 @@ | ||
<?php | ||
|
||
/** | ||
* Gets the current HTTP request as sent by the client. | ||
* | ||
* @return Psr\Http\Message\RequestInterface The current request. | ||
*/ | ||
function get_current_request() { | ||
static $request; | ||
|
||
if (!$request) { | ||
$request = Meek\Http\ServerRequest::createFromGlobals(); | ||
} | ||
|
||
return $request; | ||
} | ||
|
||
/** | ||
* Sends a HTTP response to the client. | ||
* | ||
* @param string $body The response body to send to the client. | ||
* @param integer $code The HTTP status code. | ||
* @param array $headers A list of optional headers to add to the response. | ||
* | ||
* @return Psr\Http\Message\RequestInterface The sent response. | ||
*/ | ||
function send_response($body = '', $code = 200, array $headers = []) { | ||
$response = new Meek\Http\Response(null, $code, $headers); | ||
$response->getBody()->write($body); | ||
|
||
return $response->prepare(get_current_request())->send(); | ||
} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.