include method
Includes the given uri
.
*
- If
request
orresponse
is ignored, this connect's request or response is assumed. - If
uri
is null,connect.uri
is assumed, i.e., includes the same handler. - After calling this method, the caller shall write the output stream in
then
, since - the request handler for the given URI might handle it asynchronously. For example,
-
await connect.include(connect, "another");
-
connect.response.write("<p>More content</p>");
-
...
-
uri
- the URI to chain. If omitted, it is the same as this connection.
- It can contain the query string too.
- ##Difference between forward and include
- forward and include are almost the same, except
-
- The included request handler won't be able to generate any HTTP headers
- (it is the job of the caller). Any updates to HTTP headers in the included
- request handler are simply ignored.
- Notice the default implementation is
connect.include(connect, uri...)
.
Implementation
@override
Future include(String uri, {HttpRequest? request, HttpResponse? response})
=> origin.include(uri, request: request ?? this.request,
response: response != null ? response: this.response);