Class JsonHttpMethodBuilderExtensions
Provides static builder extension methods dealing with the HTTP method and JSON.
Namespace: ReqRest.Serializers.NewtonsoftJson
Assembly: ReqRest.Serializers.NewtonsoftJson.dll
Syntax
public static class JsonHttpMethodBuilderExtensions
Methods
PatchJson<T>(T, Nullable<Object>, Nullable<Encoding>, Nullable<JsonHttpContentSerializer>)
Sets the HttpMethod to the HTTP PATCH
method and then
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 PatchJson<T>(this T builder, object? content, Encoding? encoding = default(Encoding? ), JsonHttpContentSerializer? serializer = default(JsonHttpContentSerializer? ))
where T : IHttpMethodBuilder, 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. |
Remarks
Calling this method is equivalent to calling Post<T>(T)
and
PostJson<T>(T, Nullable<Object>, Nullable<Encoding>, Nullable<JsonHttpContentSerializer>)
Sets the HttpMethod to the HTTP POST
method and then
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 PostJson<T>(this T builder, object? content, Encoding? encoding = default(Encoding? ), JsonHttpContentSerializer? serializer = default(JsonHttpContentSerializer? ))
where T : IHttpMethodBuilder, 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. |
Remarks
Calling this method is equivalent to calling Post<T>(T)
and
PutJson<T>(T, Nullable<Object>, Nullable<Encoding>, Nullable<JsonHttpContentSerializer>)
Sets the HttpMethod to the HTTP PUT
method and then
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 PutJson<T>(this T builder, object? content, Encoding? encoding = default(Encoding? ), JsonHttpContentSerializer? serializer = default(JsonHttpContentSerializer? ))
where T : IHttpMethodBuilder, 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. |
Remarks
Calling this method is equivalent to calling Post<T>(T)
and