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.
Afficher le fichier Open project: dax70/MvcApi

Méthodes publiques

Méthode 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

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

Method Details

GetHttpMethod() public static méthode

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
Résultat string

GetRequestFormat() public static méthode

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

GetResponseFormats() public static méthode

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
Résultat List

IsBrowserRequest() public static méthode

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

QueryString() public static méthode

public static QueryString ( this requestContext ) : NameValueCollection
requestContext this
Résultat System.Collections.Specialized.NameValueCollection