Share via


DefaultContentNegotiator.MatchRequestMediaType Method

Match the content type of a request against the media types that a formatter supports.

Namespace:  System.Net.Http.Formatting
Assembly:  System.Net.Http.Formatting (in System.Net.Http.Formatting.dll)

Syntax

'Declaration
Protected Overridable Function MatchRequestMediaType ( _
    request As HttpRequestMessage, _
    formatter As MediaTypeFormatter _
) As MediaTypeFormatterMatch
'Usage
Dim request As HttpRequestMessage 
Dim formatter As MediaTypeFormatter 
Dim returnValue As MediaTypeFormatterMatch 

returnValue = Me.MatchRequestMediaType(request, _
    formatter)
protected virtual MediaTypeFormatterMatch MatchRequestMediaType(
    HttpRequestMessage request,
    MediaTypeFormatter formatter
)
protected:
virtual MediaTypeFormatterMatch^ MatchRequestMediaType(
    HttpRequestMessage^ request, 
    MediaTypeFormatter^ formatter
)
abstract MatchRequestMediaType : 
        request:HttpRequestMessage * 
        formatter:MediaTypeFormatter -> MediaTypeFormatterMatch  
override MatchRequestMediaType : 
        request:HttpRequestMessage * 
        formatter:MediaTypeFormatter -> MediaTypeFormatterMatch
protected function MatchRequestMediaType(
    request : HttpRequestMessage, 
    formatter : MediaTypeFormatter
) : MediaTypeFormatterMatch

Parameters

  • request
    Type: HttpRequestMessage

    The request.

Return Value

Type: System.Net.Http.Formatting.MediaTypeFormatterMatch
Returns a MediaTypeFormatterMatch object that indicates the quality of the match, or null if there is no match.

Remarks

If the request conatins an entity body, this method attempts to match the formatter with the content type the request.

See Also

Reference

DefaultContentNegotiator Class

System.Net.Http.Formatting Namespace