IsJsonType() public static method

Attempts to detect if the content type is JSON. Supports: application/json text/json application/vnd[something]+json Matches are case insentitive to try and be as "accepting" as possible.
public static IsJsonType ( string contentType ) : bool
contentType string Request content type
return bool
 /// <summary>
 /// Whether the deserializer can deserialize the content type
 /// </summary>
 /// <param name="mediaRange">Content type to deserialize</param>
 /// <param name="context">Current <see cref="BindingContext"/>.</param>
 /// <returns>True if supported, false otherwise</returns>
 public bool CanDeserialize(MediaRange mediaRange, BindingContext context)
 {
     return(Helpers.IsJsonType(mediaRange));
 }
Esempio n. 2
0
 /// <summary>
 /// Whether the serializer can serialize the content type
 /// </summary>
 /// <param name="mediaRange">Content type to serialise</param>
 /// <returns>True if supported, false otherwise</returns>
 public bool CanSerialize(MediaRange mediaRange)
 {
     return(Helpers.IsJsonType(mediaRange));
 }