C# Class MvcApi.RequestContextExtensions

Extension methods that facilitate support for content negotiation and HTTP method overload. The results for GetHttpMethod() GetRequestFormat() and GetResponseFormats() are cached on the RouteData dictionary.
ファイルを表示 Open project: dax70/MvcApi

Public Methods

Method Description
GetHttpMethod ( this requestContext ) : string

Returns the HTTP method of the request, honoring override via the "X-Http-Method-Override" HTTP header or a form variable with the same name.

GetRequestFormat ( this requestContext ) : ContentType

Returns the format of a given request.

GetResponseFormats ( this requestContext ) : List

Returns a collection of formats that should be used to render a response to a given request, sorted in priority order.

IsBrowserRequest ( this requestContext ) : bool

Determines whether the specified HTTP request was sent by a Browser.

QueryString ( this requestContext ) : NameValueCollection

Private Methods

Method Description
GetAndCacheObject ( System.Web.Routing.RequestContext requestContext, string key, object>.Func getter ) : object

Method Details

GetHttpMethod() public static method

Returns the HTTP method of the request, honoring override via the "X-Http-Method-Override" HTTP header or a form variable with the same name.
public static GetHttpMethod ( this requestContext ) : string
requestContext this
return string

GetRequestFormat() public static method

Returns the format of a given request.
If the format is unrecognized or not supported.
public static GetRequestFormat ( this requestContext ) : ContentType
requestContext this
return System.Net.Mime.ContentType

GetResponseFormats() public static method

Returns a collection of formats that should be used to render a response to a given request, sorted in priority order.
public static GetResponseFormats ( this requestContext ) : List
requestContext this
return List

IsBrowserRequest() public static method

Determines whether the specified HTTP request was sent by a Browser.
public static IsBrowserRequest ( this requestContext ) : bool
requestContext this
return bool

QueryString() public static method

public static QueryString ( this requestContext ) : NameValueCollection
requestContext this
return System.Collections.Specialized.NameValueCollection