Module: Aspera::Mime

Defined in:
lib/aspera/mime.rb

Overview

MIME types used in Content-Type and Accept

Constant Summary collapse

JSON =

JSON body

'application/json'
WWW =

URL encoded form body

'application/x-www-form-urlencoded'
TEXT =

Plain text body

'text/plain'
JSON_API =

JSON:API body (https://jsonapi.org)

'application/vnd.api+json'

Class Method Summary collapse

Class Method Details

.json?(mime) ⇒ Boolean

Check if a media type is JSON: application/json or structured syntax suffix +json (RFC 6839)

Parameters:

  • mime (String) —

    Media type, without parameters (see Rest.parse_header)

Returns:

  • (Boolean) —

    true if JSON



17
# File 'lib/aspera/mime.rb', line 17

def json?(mime) = mime == JSON || mime.end_with?(JSON_SUFFIX) || mime == LEGACY_JSON