Class: Stitches::ValidMimeType

Inherits:
AllowlistMiddleware show all
Defined in:
lib/stitches/valid_mime_type.rb

Overview

A middleware that requires all API calls to be for versioned JSON or Protobuf.

This means that the Accept header (available to Rack apps as HTTP_ACCEPT) should be like so:

application/json; version=1

This just checks that you’ve specified some numeric version. ApiVersionConstraint should be used to “lock down” the versions you accept.

Or in the case of a protobuf encoded payload the header should be like so:

application/protobuf

There isn’t an accepted standard for protobuf encoded payloads but this form is common.

Method Summary

Methods inherited from AllowlistMiddleware

#call, #initialize

Constructor Details

This class inherits a constructor from Stitches::AllowlistMiddleware