Content Other than JSON

RestClient is biased towards RESTFul API’s returning JSON - by default if you don’t provide Accept and Content-Type headers then they are set to application/json.

However you can use RestClient to access anything, the only difference is implicit casting isn’t supported (without configuring a Pipeline).

Example usage:

dynamic google = new RestClient("", new Headers(new { Accept = "text/html" });

var result = await google.News.Get();

Assert.That(result.HttpResponseMessage.StatusCode, Is.EqualTo(HttpStatusCode.OK));
Assert.That(result.ToString(), Is.StringContaining("Google News"));

This is a trivial example if you configure a Pipeline you can pretty much do anything with RestClient.

Posting forms

See FormUrlEncodedHandler

Posting files

See MultipartFormdDataHandler