ga4gh.refget.serverless.middleware.media_type

Checks request headers for correct/appropriate media types

Functions

ga4gh.refget.serverless.middleware.media_type.MediaTypeMidware(event, context, supported_media_types=['application/vnd.ga4gh.refget.v1.0.0+json'])

Creates the media type middleware decorator function

Parameters
  • event (dict[str, object]) – AWS SAM event (incl. headers, path params, query params)

  • context (dict[str, str]) – AWS SAM context

  • supported_media_types (list[str]) – supported MIME types for this api route

Returns

media type middleware decorator function

Return type

function

Classes

  • MediaTypeMW: Middleware, checks request for appropriate media types

class ga4gh.refget.serverless.middleware.media_type.MediaTypeMW

Middleware, checks request for appropriate media types

MediaTypeMW middleware checks the “Accept” header of the request. If the request only accepts MIME types that the refget app cannot satisfy, it sets the response status code to NOT ACCEPTABLE

Inheritance

Inheritance diagram of MediaTypeMW
static middleware_func(event, resp, supported_media_types)

performs all media type validation submethods

Parameters
  • event (dict[str, object]) – AWS SAM event (incl. headers, path params, query params)

  • resp (class:ga4gh.refget.serverless.cls.http.response.Response) – response object to modify

  • supported_media_types (list[str]) – MIME types supported by server route