Table of Contents

Method WithJsonContent

Namespace
HttpBuildR
Assembly
HttpBuildR.Response.dll

WithJsonContent<T>(HttpResponseMessage, T, JsonSerializerOptions?, string)

Modifies the HttpResponseMessage with json StringContent

public static HttpResponseMessage WithJsonContent<T>(this HttpResponseMessage response, T content, JsonSerializerOptions? options = null, string mediaType = "application/json") where T : notnull

Parameters

response HttpResponseMessage

response

content T

response content

options JsonSerializerOptions

optional JsonSerializerOptions

mediaType string

media type to use, default is application/json

Returns

HttpResponseMessage

response

Type Parameters

T

WithJsonContent<T>(HttpResponseMessage, T, JsonTypeInfo<T>, string)

Modifies the HttpResponseMessage with json StringContent

public static HttpResponseMessage WithJsonContent<T>(this HttpResponseMessage response, T content, JsonTypeInfo<T> typeInfo, string mediaType = "application/json") where T : notnull

Parameters

response HttpResponseMessage

response

content T

response content

typeInfo JsonTypeInfo<T>

json JsonTypeInfo for the T

mediaType string

media type to use, default is application/json

Returns

HttpResponseMessage

response

Type Parameters

T