C# Класс MvcApi.HttpRequestBaseExtensions

Extension methods that facilitate support for content negotiation and HTTP method overload.
Показать файл Открыть проект

Открытые методы

Метод Описание
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)

Приватные методы

Метод Описание
HasBody ( this request ) : bool

Описание методов

GetRequestFormat() публичный статический Метод

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.
Результат System.Net.Mime.ContentType

GetResponseFormats() публичный статический Метод

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.
Результат List

IsBrowserRequest() публичный статический Метод

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.
Результат bool