Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

docs: Improve closing of life-of-a-request.

Tim Abbott39dea1feaf0c
diff --git a/docs/tutorials/life-of-a-request.md b/docs/tutorials/life-of-a-request.md
index 3cf6c983ea4..f76b187972a 100644
--- a/docs/tutorials/life-of-a-request.md
+++ b/docs/tutorials/life-of-a-request.md
@@ -198,18 +198,22 @@ Our API works on JSON requests and responses. Every API endpoint should
{"result": "error", "msg": "<some error message>", "code": "BAD_REQUEST"}
```
-in a
-[HTTP response](https://docs.djangoproject.com/en/3.2/ref/request-response/)
-with a content type of 'application/json'.
+in a [Django HttpResponse
+object](https://docs.djangoproject.com/en/3.2/ref/request-response/)
+with a `Content-Type` of 'application/json'.
To pass back data from the server to the calling client, in the event of
a successfully handled request, we use `json_success(request, data)`.
-The request argument is a
-[HTTP request](https://docs.djangoproject.com/en/3.2/ref/request-response/)
-with additional metadata that Zulip associates with the request object.
-The data argument is a python object which can be converted to a JSON string
-and has a default value of an empty python dictionary.
+The `request` argument is a [Django HttpRequest
+object](https://docs.djangoproject.com/en/3.2/ref/request-response/).
+The `data` argument is a Python object which can be converted to a JSON
+string and has a default value of an empty Python dictionary.
+
+Zulip stores additional metadata it has associated with that HTTP
+request in a `RequestNotes` object, which is primarily accessed in
+common code used in all requests (middleware, logging, rate limiting,
+etc.).
This will result in a JSON string:
@@ -217,6 +221,6 @@ This will result in a JSON string:
{"result": "success", "msg": "", "data": {"var_name1": "var_value1", "var_name2": "var_value2"}}
```
-with a HTTP 200 status and a content type of 'application/json'.
+with a HTTP 200 status and a `Content-Type` of 'application/json'.
That's it!