- Fixes for Blazor WASM
- Add class constraint for TContent types and serialization
- Add possibility for request with content (like POST, PUT ...) to use methods : WithBasicAuthentication WithOAuthBearer WithTimeout WithETagContainer.
- Allow non 2xx response (see sample below)
Allow any status codes :
client.Settings.HttpStatusCodeAllowed.AllowAnyStatus = true;
Allow only a range of http status codes :
client.Settings.HttpStatusCodeAllowed.Add(new HttpStatusRange(400, 420));
or
client.Settings.HttpStatusCodeAllowed.Add(new HttpStatusRange(System.Net.HttpStatusCode.BadRequest, System.Net.HttpStatusCode.BadGateway));
Allow all status code :
request.AllowAllHttpStatusCode().ExecuteAsync();
Allow only a range of http status codes :
request.AllowRangeHttpStatusCode(400, 420).ExecuteAsync();
Allow only on stats code of http status codes :
request.AllowSpecificHttpStatusCode(409).ExecuteAsync();
- Add icon and license in nuget package
- Add overload with long type for AddQueryParameter method
- Add new nuget tags
- Now calculate dynamically the headers to add to resquest.
In this sample we get a custom token and add it to all our requests =>
client.Settings.CalculateHeadersHandler = async () =>
{
var token = await GetACustomTokenAsync();
var headers = new Headers
{
{ "CustomToken", token },
};
return headers;
};
- Now HttpException expose the headers of the response
- Constructor of HttpException is now internal
- Add possibility to encapsulate HttpException automatically.
We can setup a global handler to provide a logic to encapsulate HttpException automatically. For example I can choose to translate all HttpException with StatusCode NotFound in a NotFoundCustomException.
client.Settings.EncapsulateHttpExceptionHandler = (ex) =>
{
if (ex.StatusCode == System.Net.HttpStatusCode.NotFound)
{
return new NotFoundCustomException();
}
return ex;
};
Now if I call an API wich respond with status code NotFound it will throw automaticaly my custom exception.
// Call an API wich throw NotFound error
await client.GetRequest("APIWhichNotExists").ExecuteAsync();
- Fix patch request which sent patch verb in lowercase
- Add support of Entity Tag (ETag)
ETag is not enabled by default to enable it :
client.Settings.ETagContainer = new ETagFileContainer(@"C:\ETagFolder");
You can also enable on only on specific request like below :
request.WithETagContainer(eTagContainer);
- Add support of string content (for mono part and multipart requests)
request.AddStringContent("myContent").ExecuteAsycnc();
- Now the assembly is strong named
- Fix a bug on cURL listener (when body was null) the cURL request wasn't displayed
- Fix a bug on cURL listener
- Add the possibility to debug the lib with source link (https://www.hanselman.com/blog/ExploringNETCoresSourceLinkSteppingIntoTheSourceCodeOfNuGetPackagesYouDontOwn.aspx)
- Add 2 new supported media tye for json : "application/json-patch+json", "application/*+json"
- Fix null reference exception when adding 2 times te same header
- Add new listener to print cURL request in debug output. To enable it :
client.Settings.Listeners.AddCurl();
It produce this type of output in debug window for each ExecuteAsync called :
curl -X POST "http://localhost:4242/api/PostTest/complex"-H "Accept: application/json" -H "Content-Type: application/json" -d "{\"Id\":42,\"Data\":\"DATA\"}"
- The XmlFormatter now produce not indented xml (lighter than previous)
- The XmlFormatter have ne property WriterSettings which allow to configure the way to write XML streams
- Add support of CamelCase (PropertyName => propertyName) for JsonFormatter
- Add support of SnakeCase (PropertyName => property_name) for JsonFormatter
- Add support of KebabCase also known as SpinalCase (PropertyName => property-name) for JsonFormatter
- Add support of Defalte
- Change the message of HttpException to be easier to understand
- Fix a bug on headers reading
- Fix a small bug on postman of generation of postman file
- Fix a bug when response is a byte array
- Fix a bug on Multipart which didn't took the serializer specified on the request
- Add support of Basic authentication
- Add support of OAuth 2.0 authentication
- Add support of .NET Framework 4.5, 4.6, 4.7
- Add support of .NET Standard 1.1, 1.2
- Add support of automatic decompression of GZIP
- Add the possibility to define timeout globaly or by request
- Now the API throw a TimeoutException when request is in timeout
- Add better support of cancellation tokens
Thanks to Thomas Levesque for the help.
- Rename PostMan to postman
- Add SerializerException
- Add PostMan listener
- Fix NullReferenceException when ContentType is null and the client try to deserialize it.
- Fix small bugs
- Fix small issue on formatting of debug formatter
- Support of netstandard1.3 (thanks to Benoit F)
- Now the DebugListener use the class Debug to log data. (Thx to Thomas Levesque for the code review)
- Fix some typos
- Rewrite the way to listen the client
- Add 'Settings' property with all settings of client
- Fix a bug on JsonFormatter which not used JsonSerializer config
- Now NewRequest use HttpMethod instead of HttpVerb enum
- Fix null reference exception if ContentType of response is null
- Fix AddQueryParameter when value is null (for server which are not in ASP.net Core)
- Add methods AddFormatter / RemoveFormatter
- Add a way to read responses headers
- Add the possibility to have raw string response
- Add the possibility to have raw HttpResponseMessage
- Add method to add file as content
- Add method to add file as content in multipart requests
- Add support of file content (multipart and normal request)
- Add overloads on method AddQueryStringParameters
- Fix an issue on AddHeader
- Add new overloads for PostRequest, PutRequest, PatchRequest
- Add overload on ExecuteAsync method (with less parameters)
- Remove hardcoded Headers and Add AddAcceptLanguageBasedOnCurrentCulture which add automaticaly current language
- Now the formatter have multiple accept types
- Add auto detect of which formatter to use
- Add methods : GetRequest PostRequest, PutRequest, DeleteRequest on TinyHttpClient
- Add support of multi-part form data
- Now the query parameters are url encoded.
- Otpimizations.
- Add documentation
Initial version
- Now the formatter surpport multi accept type
- Otpimizations. Add support of multi-part form data