-
Notifications
You must be signed in to change notification settings - Fork 0
MayRest
MayRest is a wrapper around the standard dart http library, that generally simplifies calls.
It has some useful features like being able to set default headers, and a token, so that you don't have to specify them in every call.
These are the default headers added to every api call made. If you pass anything into the headers field of a call, these will be overridden. Defaults to:
static Map<String, String> defaultHeaders = {
'Content-Type': 'application/json',
'Accept': 'application/json'
};Disables the colors for the static MayRest Log object.
Overrides the default headers added to each call.
static Future<Response> get(String url, {bool quiet, String? token, bool noToken, Map<String,String>? headers})
Makes a get request to url. If quiet, no logs will show. If noToken, regardless of tokens set, no auth token will be passed. headers passed will be added to defaultHeaders. If any headers overlap, they will be overwritten. token allows you to use a different token in each request, rather than the token stored in Session.token
Future<Response> post(String url, dynamic body, {bool quiet, bool noToken, Map<String, String>? headers})
Posts body to url. All other parameters behave the same as get
static Future<Response> put(String url, dynamic body, {bool quiet, bool noToken, Map<String, String>? headers})
Puts body at url. All other parameters behave the same as get
static Future<Response> delete(String url, dynamic body, {bool quiet, bool noToken, Map<String, String>? headers})
Deletes body at url. All other parameters behave the same as get
Models - Currently Empty