You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How can I retrieve the http status code alongside the returned object, particularly when something goes wrong? I don't want the raw response; I would like to receive something like:
Happy path: The actual list of students + 200
Unhappy path 1: null + 500
Unhappy path 2: null + 404
I own the Web APIs service that the Refit client is trying to reach. So, I could create an augmented response model, for example something like:
publicclassMyResponse{publicList<Student> Students {get;set;}publicintHttpResponseCode{get;set;}}
But, is there a built-in way to handle this gracefully by Refit? Thanks a lot! 👍
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, imagine I have this interface:
How can I retrieve the http status code alongside the returned object, particularly when something goes wrong? I don't want the raw response; I would like to receive something like:
Happy path: The actual list of students + 200
Unhappy path 1: null + 500
Unhappy path 2: null + 404
I own the Web APIs service that the Refit client is trying to reach. So, I could create an augmented response model, for example something like:
But, is there a built-in way to handle this gracefully by Refit? Thanks a lot! 👍
Beta Was this translation helpful? Give feedback.
All reactions