-
Notifications
You must be signed in to change notification settings - Fork 0
Options
vixez edited this page Apr 18, 2016
·
3 revisions
You can pass on options to the GET/POST/PUT/DELETE function. For example:
JsonHttp.Options options = new JsonHttp.Options()
{
AllowAutoRedirect = true,
DefaultRequestHeaders = new Dictionary<string, string>(),
AddMediaTypeWithQualityHeadersJson = true,
UseLocationHeaderForRedirects = true
};
Then you can add the options at the end:
WordOfTheDay wotd = await JsonHttp.Get<WordOfTheDay>(new Uri("http://urban-word-of-the-day.herokuapp.com/today"), options);
This allows to follow redirect responses
When a redirect response is received, the Location header in the response will be used as redirect URL
Adds an accept header of "application/json"
You can add a dictionary of headers to add to DefaultRequestHeaders
Sets a timeout on the request, an exception is thrown when a timeout occurs
Override the HttpClient used in the library, this also overrides all of the set options