From 521aac45e14c3f4519d53882e6a914322706b485 Mon Sep 17 00:00:00 2001 From: Abdelrahman Saed Date: Wed, 29 Apr 2020 07:22:11 +0200 Subject: [PATCH] ## The Request Object Code old code router.route("/path").linkFunction((req) { req.attachments["key"] = "value"; //here u forget to return reqast }).linkFunction((req) { return Response.ok({"key": req.attachments["value"]});//in first linkFunction u add key with name "key" }); router .route("/path") .linkFunction((req) => req..attachments["key"] = "value") .linkFunction((req) => Response.ok({"key": req.attachments["key"]})); --- source/docs/http/request_and_response.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source/docs/http/request_and_response.md b/source/docs/http/request_and_response.md index f1fe5e63b..39034c3cc 100644 --- a/source/docs/http/request_and_response.md +++ b/source/docs/http/request_and_response.md @@ -9,11 +9,10 @@ A `Request` is created for each HTTP request to your application. A `Request` st All properties of a request are available in its `raw` property (a Dart standard library `HttpRequest`). A `Request` has `attachments` that data can be attached to in a controller for use by a linked controller: ```dart -router.route("/path").linkFunction((req) { - req.attachments["key"] = "value"; -}).linkFunction((req) { - return Response.ok({"key": req.attachments["value"]}); -}); + router + .route("/path") + .linkFunction((req) => req..attachments["key"] = "value") + .linkFunction((req) => Response.ok({"key": req.attachments["key"]})); ``` A `Request` also has two built-in attachments, `authorization` and `path`. `authorization` contains authorization information from an `Authorizer` and `path` has request path information from a `Router`.