0.0
No commit activity in last 3 years
No release in over 3 years
Parse a version from the content type string and then use it in the environment variable. For example: 'Content-type:text/html;vnd.example-com.foo+json; version=1.1' will be parsed into 1.1
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

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