Search code examples
c#restsharp

What would my return type be if I want to return the whole response


I am working on testing some APIs with RestSharp and have a method which I would like to return the whole response object.

Here is my method I am just wondering what the return type would be. Kind of a noob to C# which is why I am asking.

    public static SendGetRequestWithResponse(string endpoint)
    {
        RestRequest request = new(endpoint, Method.Get);
        var response = _restClient.ExecuteGet(request);
        return response;
    }

Solution

  • It returns a RestResponse object. Check their official docs here for more details.