agent/agent/http/fetch library

Classes

FetchResponse

Constants

defaultTimeout → const Duration

Functions

defaultFetch({required String endpoint, String? host, String? defaultHost, FetchMethod method = FetchMethod.post, Map<String, String>? baseHeaders, Map<String, String>? headers, Duration? timeout = defaultTimeout, bool cbor = true, dynamic body}) Future<Map<String, dynamic>>
defaultFetch is a wrapper of http.get, which can be replaced by any other http packages (e.g. dio). http has embedded by default, so the library use it directly. Users can set host should be full path of http/https. Usually the usage could be defaultHost+endpoint and set the defaultHost to somewhere final, then change the endpoint programatically. Duration(second: 30) is the default timeout limit, and throw error directly to end the request section.