FormUrlEncodedFormatter Class
- Namespace
- Kampute.HttpClient.Content
- Assembly
- Kampute.HttpClient.dll
Definition
Writes collections of key-value pairs as URL-encoded form content.
public sealed class FormUrlEncodedFormatter : HttpContentFormatter- Inheritance
- object
- HttpContentFormatter
- FormUrlEncodedFormatter
Remarks
Constructors
FormUrlEncodedFormatter()
Initializes a new instance of the FormUrlEncodedFormatter class.
public FormUrlEncodedFormatter()Methods
CanWriteType(Type)
Determines whether the payload type is a collection of string key-value pairs.
protected override bool CanWriteType(Type payloadType)Parameters
payloadTypeType- The type of the payload to write.
Returns
- bool
trueifpayloadTypeimplements IEnumerable<T> of KeyValuePair<TKey, TValue> with string keys and values; otherwise,false.
CreateContent(object, string)
Creates URL-encoded form content from the payload.
protected override HttpContent CreateContent(object payload, string mediaType)Parameters
payloadobject- The collection of key-value pairs to write.
mediaTypestring- The media type of the content to create.
Returns
- HttpContent
- A FormUrlEncodedContent that carries
payload.

application/x-www-form-urlencodedcontent, and does not read responses. The form helpers of HttpRestClientFormExtensions use it.