... | ... | @@ -47,7 +47,7 @@ Lets take advantage of that, to add timing data our request/response cycle, run |
|
|
|
|
|
Enter insert-mode ( press `i` ), and insert the following code at line 7 ( below `app = FastAPI()` )
|
|
|
|
|
|
```plaintext
|
|
|
```python
|
|
|
|
|
|
from time import time
|
|
|
from fastapi import Request
|
... | ... | @@ -61,11 +61,13 @@ async def add_process_time_header(request: Request, call_next): |
|
|
response.headers["X-Process-Time"] = str(process_time)
|
|
|
return response
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
Exit _insert-mode_ by pressing `Esc`, and save the file using `:w`
|
|
|
|
|
|
The server will auto-reload your changes within 5 seconds
|
|
|
_*Note*: For the impatient out there, the issue can be forced by pressing *F5* in vim_
|
|
|
The server will auto-reload your changes within 5 seconds
|
|
|
_**Note**: For the impatient out there, the issue can be forced by pressing **F5** in vim_
|
|
|
|
|
|
Change to your browser window, and refresh the page from before by pressing *F5* |
|
|
\ No newline at end of file |
|
|
Change to your browser window, and refresh the page from before by pressing **F5**
|
|
|
_**Note**: While the server reloads the changes, the browser might display "bad gateway" or "unreachable site" messages._ |
|
|
\ No newline at end of file |