Skip to content

Add Standard Http base methods to Client Proxy Base #1027

@StuartFerguson

Description

@StuartFerguson

Add standard methods for GET,POST,PUT,PATCH,DELETE

Here is an example for GET

private async Task<Result<String>> SendGetRequest(String uri, String accessToken, CancellationToken cancellationToken) {

        HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Get, uri);
        requestMessage.Headers.Authorization = new AuthenticationHeaderValue(AuthenticationSchemes.Bearer, accessToken);

        // Make the Http Call here
        HttpResponseMessage httpResponse = await this.HttpClient.SendAsync(requestMessage, cancellationToken);

        // Process the response
        Result<String> result = await this.HandleResponseX(httpResponse, cancellationToken);

        if (result.IsFailed)
            return ResultHelpers.CreateFailure(result);

        return Result.Success<String>(result.Data);
    }

Methods that take in content such as POST could they be gerneric of type T?

Metadata

Metadata

Assignees

No one assigned

    Labels

    taskTasks and work items

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions