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
HttpResponseMessageresponse
content
Tresponse content
options
JsonSerializerOptionsoptional JsonSerializerOptions
mediaType
stringmedia 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
HttpResponseMessageresponse
content
Tresponse content
typeInfo
JsonTypeInfo<T>json JsonTypeInfo for the T
mediaType
stringmedia type to use, default is
application/json
Returns
- HttpResponseMessage
response
Type Parameters
T