C# Class MvcApi.HttpRequestBaseExtensions

Extension methods that facilitate support for content negotiation and HTTP method overload.
Afficher le fichier Open project: dax70/MvcApi

Méthodes publiques

Méthode Description
GetRequestFormat ( this request ) : ContentType

Returns the format of a given request.

GetResponseFormats ( this request ) : List

Returns the preferred content type to use for the response, based on the request, according to the following rules: 1. If the query string contains a key called "format", its value is returned as the content type 2. Otherwise, if the request has an Accepts header, the list of content types in order of preference is returned 3. Otherwise, if the request has a content type, its value is returned

IsBrowserRequest ( this request ) : bool

Determines whether the specified HTTP request was sent by a Browser. A request is considered to be from the browser if it's a GET or POST and has a known User-Agent header (as determined by the request's BrowserCapabilities property), and does not have a non-HTML entity format (XML/JSON)

Private Methods

Méthode Description
HasBody ( this request ) : bool

Method Details

GetRequestFormat() public static méthode

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

GetResponseFormats() public static méthode

Returns the preferred content type to use for the response, based on the request, according to the following rules: 1. If the query string contains a key called "format", its value is returned as the content type 2. Otherwise, if the request has an Accepts header, the list of content types in order of preference is returned 3. Otherwise, if the request has a content type, its value is returned
public static GetResponseFormats ( this request ) : List
request this The request.
Résultat List

IsBrowserRequest() public static méthode

Determines whether the specified HTTP request was sent by a Browser. A request is considered to be from the browser if it's a GET or POST and has a known User-Agent header (as determined by the request's BrowserCapabilities property), and does not have a non-HTML entity format (XML/JSON)
public static IsBrowserRequest ( this request ) : bool
request this The request.
Résultat bool