p-meier / hapi-api-version

An API versioning plugin for hapi.
Apache License 2.0
74 stars 26 forks source link

Looking for ability to parse Accept headers of different formats #4

Closed kdstew closed 8 years ago

kdstew commented 8 years ago

We have multiple apps running on different frameworks and we are wanting to get the version string in the Accept header to be consistent across the apps.

For instance we have a hapi app that looks for an Accept header like the following: application/vnd.myapi.v2+json

And we have a rails app that is looking for an Accept header like the following: application/vnd.myapi+json; version=2

To accomplish this we were thinking we could add the option to pass an extractVersionFromAcceptHeader function in the options. If this function is passed it will be run instead of the built in _extractVersionFromAcceptHeader function. This would give us the most flexibility on how the version is passed in the Accept header.

I'm going to work on making the modifications, but wanted to get your thoughts as well

kdstew commented 8 years ago

see https://github.com/p-meier/hapi-api-version/pull/5