SwiftHttpHelper class
Helper class to intercept HTTP requests made with the http package
This provides a simple way to wrap http package calls to automatically capture requests and responses for debugging.
Example usage:
import 'package:http/http.dart' as http;
// Instead of: final response = await http.get(Uri.parse('https://api.example.com/data'));
// Use:
final response = await SwiftHttpHelper.intercept(
() => http.get(Uri.parse('https://api.example.com/data')),
method: 'GET',
url: 'https://api.example.com/data',
);
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
intercept<
T> (Future< T> requestFn(), {required String method, required String url, dynamic body, Map<String, String> ? headers}) → Future<T> - Intercept any HTTP request
-
interceptDelete<
T> (Future< T> requestFn(), String url) → Future<T> - Intercept an HTTP DELETE request
-
interceptGet<
T> (Future< T> requestFn(), String url) → Future<T> - Intercept an HTTP GET request
-
interceptPatch<
T> (Future< T> requestFn(), String url, dynamic body, Map<String, String> ? headers) → Future<T> - Intercept an HTTP PATCH request
-
interceptPost<
T> (Future< T> requestFn(), String url, dynamic body, Map<String, String> ? headers) → Future<T> - Intercept an HTTP POST request
-
interceptPut<
T> (Future< T> requestFn(), String url, dynamic body, Map<String, String> ? headers) → Future<T> - Intercept an HTTP PUT request