Skip to content

Give a choice whether to throw an exception or not when response status code is not successful #882

@rekosko

Description

@rekosko

Hi,

Would it be a big breaking change or totally nonsense thing to include a simple boolean flag in RefitSettings that will allow us to skip throwing exception when response status code is not successful? What I mean is that my existing api is already using internal api response wrapper and I would like to always use it from Refit and don't use built in refit ApiResponse which for me at least don't give any benefits because when I use it I need to double wrap that response and that doesn't make sense and complicate things a little bit.

if (!resp.IsSuccessStatusCode && typeof(T) != typeof(HttpResponseMessage))

So the question is simple, is it doable? If not why this is a bad idea because I can't see any cons of it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions