Skip to content

Refit 1.2.0

Compare
Choose a tag to compare
@anaisbetts anaisbetts released this 20 Jun 19:32

What's New

Request Headers

Thanks to @bennor, Refit now supports adding request headers to both individual methods as well as to entire classes via the [Header] attribute. Here's an example:

[Headers("X-Emoji: :rocket:")]
public interface IGitHubApi
{
    [Get("/users/list")]
    Task<List> GetUsers();

    [Get("/users/{user}")]
    [Headers("X-Emoji: :smile_cat:")]
    Task<User> GetUser(string user);

    [Post("/users/new")]
    [Headers("X-Emoji: :metal:")]
    Task CreateUser([Body] User user, [Header("X-Emoji")] string emoji);
}