|
| 1 | +<?hh // strict |
| 2 | + |
| 3 | +/** |
| 4 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 5 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 6 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 7 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 8 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 9 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 10 | + * THE SOFTWARE. |
| 11 | + * |
| 12 | + * This software consists of voluntary contributions made by many individuals |
| 13 | + * and is licensed under the MIT license. |
| 14 | + * |
| 15 | + * Copyright (c) 2018 Yuuki Takezawa |
| 16 | + * |
| 17 | + */ |
| 18 | +namespace Nazg\Http\Server; |
| 19 | + |
| 20 | +use type HH\Lib\Experimental\IO\WriteHandle; |
| 21 | +use type Facebook\Experimental\Http\Message\ResponseInterface; |
| 22 | +use type Facebook\Experimental\Http\Message\ServerRequestInterface; |
| 23 | + |
| 24 | +/** |
| 25 | + * An HTTP middleware component participates in processing an HTTP message, |
| 26 | + * either by acting on the request or the response. This interface defines the |
| 27 | + * methods required to use the middleware. |
| 28 | + */ |
| 29 | +interface MiddlewareInterface { |
| 30 | + |
| 31 | + /** |
| 32 | + * Process an incoming server request and return a response, optionally delegating |
| 33 | + * response creation to a handler. |
| 34 | + * |
| 35 | + * @param WriteHandle $handler |
| 36 | + * @param ServerRequestInterface $request |
| 37 | + * @param RequestHandlerInterface $handler |
| 38 | + * @return ResponseInterface |
| 39 | + */ |
| 40 | + public function process( |
| 41 | + WriteHandle $writeHandle, |
| 42 | + ServerRequestInterface $request, |
| 43 | + RequestHandlerInterface $handler |
| 44 | + ): ResponseInterface; |
| 45 | +} |
0 commit comments