Class JsonHttpContentBuilderExtensions
Extends the IHttpRequestMessageBuilder interface with methods for dealing with JSON data.
Namespace: ReqRest.Serializers.NewtonsoftJson
Assembly: ReqRest.Serializers.NewtonsoftJson.dll
Syntax
public static class JsonHttpContentBuilderExtensions
Methods
SetJsonContent<T>(T, Nullable<Object>, Nullable<Encoding>, Nullable<JsonHttpContentSerializer>)
Sets the HTTP content to a serialized JSON string representing content
.
content
is serialized using the specified serializer
and encoding
.
The serialized HTTP content has the application/json
media type.
Declaration
public static T SetJsonContent<T>(this T builder, object? content, Encoding? encoding = default(Encoding? ), JsonHttpContentSerializer? serializer = default(JsonHttpContentSerializer? ))
where T : IHttpContentBuilder
Parameters
Type | Name | Description |
---|---|---|
T | builder | The request builder. |
Nullable<Object> | content | The content to be sent with the request. |
Nullable<Encoding> | encoding | The encoding to be used for converting the serialized |
Nullable<JsonHttpContentSerializer> | serializer | The JsonHttpContentSerializer to be used for the content serialization. |
Returns
Type | Description |
---|---|
T | The specified |
Type Parameters
Name | Description |
---|---|
T | The type of the builder. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|