Skip to content

Simple rack middleware which parses out a version string from the mime type.

License

Notifications You must be signed in to change notification settings

amaabca/mime_version

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

Parse a version from the content type string and then use it in the environment variable.

Mime-version is a simple rack middleware gem to parse a version string out of the content-type in the http request.

The aim is to build a better way of version API calls.

For example: Content-type:text/html;vnd.example-com.foo+json; version=1.1 will be parsed into 1.1.

Setup

Rails 3: add an initializer: mime_version.rb require 'mime_version'

Rails.application.config.middleware.use MimeVersion do
end

in a controller or view or model: you can use ENV['version'] to determine what version of API

About

Simple rack middleware which parses out a version string from the mime type.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages