0

I'm trying to handle Multi-Status 207 response from one of API.

I have created interface like:

public interface IServiceAPIs { [Post("/api/data/generate")] Task GenerateData([Body]generateDataRequest) }

and I'm receiving 200 OK as well as 207 Multi-Status with content if some generation fails. If StatusCode other than 200 range Refit generates ApiException but with 207 it is directly returning as I'm using Task

How can I handle this.? Thanks in advance.

  • Are you asking how to make Refit throw an exception if a status 207 is received? Any reason why you can't parse the response body to determine what failed if the status is 207? Welcome to Stack Overflow BTW. Please [take the tour](https://stackoverflow.com/tour) and read about [how to ask a good question](https://stackoverflow.com/help/how-to-ask). – sbridewell Apr 08 '22 at 07:49
  • Actually there are 2 success status I can expect from API. 1st is 200 OK with no content and 2nd is 207 multi-status with content if data generation failed for any of the item which sent with the request. What I want is if 207 is the status received then how can I make Refit to throw exception or how I can handle 207 by getting the content and behaviour will remains same for other status code (ie throwing exception if status other than 200 range) – Suyog Arun Khachane Apr 08 '22 at 09:01

0 Answers0