HttpRequestMessage HttpRequestMessage HttpRequestMessage HttpRequestMessage Class

定义

表示一条 HTTP 请求消息。Represents a HTTP request message.

public ref class HttpRequestMessage : IDisposable
public class HttpRequestMessage : IDisposable
type HttpRequestMessage = class
    interface IDisposable
Public Class HttpRequestMessage
Implements IDisposable
继承
HttpRequestMessageHttpRequestMessageHttpRequestMessageHttpRequestMessage
实现

注解

HttpRequestMessage类包含标头、 HTTP 谓词和可能的数据。The HttpRequestMessage class contains headers, the HTTP verb, and potentially data.

构造函数

HttpRequestMessage() HttpRequestMessage() HttpRequestMessage() HttpRequestMessage()

初始化 HttpRequestMessage 类的新实例。Initializes a new instance of the HttpRequestMessage class.

HttpRequestMessage(HttpMethod, String) HttpRequestMessage(HttpMethod, String) HttpRequestMessage(HttpMethod, String) HttpRequestMessage(HttpMethod, String)

初始化 HTTP 方法和请求 HttpRequestMessageUri 类的新实例。Initializes a new instance of the HttpRequestMessage class with an HTTP method and a request Uri.

HttpRequestMessage(HttpMethod, Uri) HttpRequestMessage(HttpMethod, Uri) HttpRequestMessage(HttpMethod, Uri) HttpRequestMessage(HttpMethod, Uri)

初始化 HTTP 方法和请求 HttpRequestMessageUri 类的新实例。Initializes a new instance of the HttpRequestMessage class with an HTTP method and a request Uri.

属性

Content Content Content Content

获取或设置 HTTP 消息的内容。Gets or sets the contents of the HTTP message.

Headers Headers Headers Headers

获取 HTTP 请求标头的集合。Gets the collection of HTTP request headers.

Method Method Method Method

获取或设置 HTTP 请求消息使用的 HTTP 方法。Gets or sets the HTTP method used by the HTTP request message.

Properties Properties Properties Properties

获取 HTTP 请求的属性集。Gets a set of properties for the HTTP request.

RequestUri RequestUri RequestUri RequestUri

获取或设置用于 HTTP 请求的 UriGets or sets the Uri used for the HTTP request.

Version Version Version Version

获取或设置 HTTP 消息版本。Gets or sets the HTTP message version.

方法

Dispose() Dispose() Dispose() Dispose()

释放由 HttpRequestMessage 使用的非托管资源和托管资源。Releases the unmanaged resources and disposes of the managed resources used by the HttpRequestMessage.

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

释放由 HttpRequestMessage 使用的非托管资源,并可根据需要释放托管资源。Releases the unmanaged resources used by the HttpRequestMessage and optionally disposes of the managed resources.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

Extension Methods

GetUserPrincipal(HttpRequestMessage) GetUserPrincipal(HttpRequestMessage) GetUserPrincipal(HttpRequestMessage) GetUserPrincipal(HttpRequestMessage)

获取与指定的 HTTP 请求消息相关的用户主体。Gets the user principal associated with the specified HTTP request message.

SetUserPrincipal(HttpRequestMessage, IPrincipal) SetUserPrincipal(HttpRequestMessage, IPrincipal) SetUserPrincipal(HttpRequestMessage, IPrincipal) SetUserPrincipal(HttpRequestMessage, IPrincipal)

替换与指定的 HTTP 请求消息相关的用户主体。Replaces the user principal associated with the specified HTTP request message.

ToMessage(HttpRequestMessage) ToMessage(HttpRequestMessage) ToMessage(HttpRequestMessage) ToMessage(HttpRequestMessage)

通过 Message 实例创建 HttpRequestMessage 实例。Creates a Message instance from an HttpRequestMessage instance.

适用于