http_middleware 0.0.1 copy "http_middleware: ^0.0.1" to clipboard
http_middleware: ^0.0.1 copied to clipboard

outdatedDart 1 only

A middleware library for Dart http library.

http_middleware #

A middleware library for Dart http library.

Getting Started #

Middleware interface to create custom middleware for http. Extend this class and override the functions that you want to intercept.

Intercepting Requests: Every function takes in a RequestData as a parameter which contains the url, body, headers and encoding from the request.

Intercepting Response: If you want to intercept response, return a Function(http.Response) from the intercepted function. You are returning a callback which will be called when the response is received.

Example (Simple logging):

class CustomMiddleWare extends MiddlewareContract {
   @override
   Function(http.Response) interceptPost({RequestData data}) {
       print("POST Url: ${data.url}");
       return (response) {
           print("POST Status: ${response.body}");
       };
   }
}
3
likes
0
pub points
62%
popularity

Publisher

unverified uploader

A middleware library for Dart http library.

Homepage

License

unknown (LICENSE)

Dependencies

flutter, http

More

Packages that depend on http_middleware