Class RestRequestBuilder

Namespace
ProtoTest.Rest
Assembly
ProtoTest.Rest.dll
public sealed class RestRequestBuilder : ProtoHttpRequestBuilder<RestResponse, RestRequestBuilder>
Inheritance
RestRequestBuilder
Inherited Members
Extension Methods

Methods

Body(Func<HttpContent>)

Supplies fresh request content for each send, allowing a builder to be reused safely.

public RestRequestBuilder Body(Func<HttpContent> contentFactory)

Parameters

contentFactory Func<HttpContent>

Returns

RestRequestBuilder

Body(object, JsonSerializerOptions?)

public RestRequestBuilder Body(object payload, JsonSerializerOptions? options = null)

Parameters

payload object
options JsonSerializerOptions

Returns

RestRequestBuilder

Body(ReadOnlyMemory<byte>, string)

public RestRequestBuilder Body(ReadOnlyMemory<byte> content, string mediaType = "application/octet-stream")

Parameters

content ReadOnlyMemory<byte>
mediaType string

Returns

RestRequestBuilder

Body(string, string)

public RestRequestBuilder Body(string rawContent, string mediaType = "text/plain")

Parameters

rawContent string
mediaType string

Returns

RestRequestBuilder

DeleteAsync(string, object?, CancellationToken)

public Task<RestResponse> DeleteAsync(string routeTemplate, object? routeAndQueryParams = null, CancellationToken ct = default)

Parameters

routeTemplate string
routeAndQueryParams object
ct CancellationToken

Returns

Task<RestResponse>

GetAsync(string, object?, CancellationToken)

public Task<RestResponse> GetAsync(string routeTemplate, object? routeAndQueryParams = null, CancellationToken ct = default)

Parameters

routeTemplate string
routeAndQueryParams object
ct CancellationToken

Returns

Task<RestResponse>

HeadAsync(string, object?, CancellationToken)

public Task<RestResponse> HeadAsync(string routeTemplate, object? routeAndQueryParams = null, CancellationToken ct = default)

Parameters

routeTemplate string
routeAndQueryParams object
ct CancellationToken

Returns

Task<RestResponse>

OnAuthenticationConfigured(string, Type?)

Records how authentication was configured; the protocol chooses attributes or events.

protected override void OnAuthenticationConfigured(string source, Type? authenticatorType)

Parameters

source string
authenticatorType Type

OnHeaderConfigured(string, bool)

Records a header configuration; isNewHeader is false on replacement.

protected override void OnHeaderConfigured(string name, bool isNewHeader)

Parameters

name string
isNewHeader bool

OptionsAsync(string, object?, CancellationToken)

public Task<RestResponse> OptionsAsync(string routeTemplate, object? routeAndQueryParams = null, CancellationToken ct = default)

Parameters

routeTemplate string
routeAndQueryParams object
ct CancellationToken

Returns

Task<RestResponse>

PatchAsync(string, object?, CancellationToken)

public Task<RestResponse> PatchAsync(string routeTemplate, object? routeAndQueryParams = null, CancellationToken ct = default)

Parameters

routeTemplate string
routeAndQueryParams object
ct CancellationToken

Returns

Task<RestResponse>

PostAsync(string, object?, CancellationToken)

public Task<RestResponse> PostAsync(string routeTemplate, object? routeAndQueryParams = null, CancellationToken ct = default)

Parameters

routeTemplate string
routeAndQueryParams object
ct CancellationToken

Returns

Task<RestResponse>

PutAsync(string, object?, CancellationToken)

public Task<RestResponse> PutAsync(string routeTemplate, object? routeAndQueryParams = null, CancellationToken ct = default)

Parameters

routeTemplate string
routeAndQueryParams object
ct CancellationToken

Returns

Task<RestResponse>

SendAsync(HttpMethod, string, object?, CancellationToken)

public Task<RestResponse> SendAsync(HttpMethod method, string routeTemplate, object? routeAndQueryParams = null, CancellationToken ct = default)

Parameters

method HttpMethod
routeTemplate string
routeAndQueryParams object
ct CancellationToken

Returns

Task<RestResponse>