DEV Community

HeyBaldur
HeyBaldur

Posted on

GOR (Generic Operation Response) Package

GOR by its acronym (Generic Operation Response) is a useful way to work with generic responses that speed up the evaluation of server responses. This helps developers to display better information in the responses that come from an HTTP request, such as GET, POST, DELETE or UPDATE.

We also use the ENUM HttpStatusCode to indicate the response from the server.

HTTP response status codes
The HttpStatusCode enumeration contains the values of the status codes defined in RFC 2616 for HTTP 1.1. The status of an HTTP request is contained in the HttpWebResponse.StatusCode property. If the HttpWebRequest.AllowAutoRedirect property is false, the following enumeration values cause an exception to be thrown:

Ambiguous
Found
MultipleChoices
Redirect
RedirectKeepVerb
RedirectMethod
SeeOther
TemporaryRedirect

Why do we use GOR?
Generally in statements like try-catch or other places in the code we also prevent the API from having failures and stop working for no reason, that's why we create GOR and so we can map everything that really happens during execution.

An excellent recommendation is also to use ILogger to have better control.

Github Repo
Nuget

Top comments (0)