'Flutter - How to access http request coming to the application
I'm building a Flutter app (Web). I want to have a debug section there. Part of it should be dumping HTTP Headers sent to the application. So I'd want to have access to an incoming request. What would be the right way to approach it?
So lets say my app sits at http://my.app. When user hits http://my.app I would like to see contents of their incoming request and then capture parts I'm interesting in like Headers.
Cheers!
Solution 1:[1]
There are two different cases. One where you want to get the headers from your HTTP client making requests after your initial page load. This can be done with interceptors where you can access and modify requests when they have been made. Interceptors are implemented by different rest client libraries like dio. Or http_interceptor if you want to work with Flutter's default client.
Accessing the initial request/response parameters is more tricky. I think Keparo's answer is a good reference point here since it should behave the same for JS/Dart in this case.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Nacho |
