HttpHelper class

General functions for sending http requests (post, get, multipart, ...)

Constructors

HttpHelper()
factory
HttpHelper.internal()
A protected constructor to allow subclasses to create themselves.

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

doDeleteRequest(Uri uri, {User? user, required UriHelper uriHelper, String? bearerToken}) Future
Sends an http DELETE request to the specified uri.
doGetRequest(Uri uri, {User? user, required UriHelper uriHelper, String? bearerToken, bool addCookiesToHeader = false}) Future
Send a http get request to the specified uri.
doMultipartRequest(Uri uri, Map<String, String> body, {Map<String, Uri>? files, User? user, required UriHelper uriHelper}) Future<Status>
Send a multipart post request to the specified uri. The data / body of the request has to be provided as map. (key, value) The files to send have to be provided as map containing the source file uri. As result a json object of the "type" Status is expected.
doPatchRequest(Uri uri, Map<String, dynamic> body, User? user, {required UriHelper uriHelper}) Future
Send a http PATCH request to the specified uri.
doPostJsonRequest(Uri uri, String jsonBody, {required UriHelper uriHelper, required String bearerToken}) Future
Sends an http POST request to the specified uri with a JSON body.
doPostRequest(Uri uri, Map<String, String> body, User? user, {required UriHelper uriHelper, required bool addCredentialsToBody, bool addCredentialsToHeader = false}) Future
Send a http post request to the specified uri.
extractResponseAsString(dynamic response) Future<String>
imagineMediaType(String filename) → dynamic
Returns the probable media type associated to that filename.
jsonDecode(String string) → dynamic
"Normal" json.decode, with an additional "html" exception.
jsonDecodeUtf8(dynamic response) → dynamic
json.decode, with utf8 conversion and additional "html" exception.
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 Properties

instance HttpHelper
Gets the instance
getter/setter pair

Static Methods

addUserAgentParameters(Map<String, dynamic>? map) Map<String, dynamic>
Adds user agent data to parameters, for statistics purpose

Constants

FROM → const String
userInfoForTest → const String