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
responseHttpResponseMessageresponse
contentTresponse content
optionsJsonSerializerOptionsoptional JsonSerializerOptions
mediaTypestringmedia 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
responseHttpResponseMessageresponse
contentTresponse content
typeInfoJsonTypeInfo<T>json JsonTypeInfo for the T
mediaTypestringmedia type to use, default is
application/json
Returns
- HttpResponseMessage
response
Type Parameters
T