Hi,
We’re using headers for versioning, and would like to support an unspecified version. For example, this is a normal, versioned, API call:
`curl -H "Accept: application/json; version=1" https://.../apiCall`
We’d also like to allow clients to omit the version, and have this succeed:
curl https://.../apiCall
Is this possible?
Thanks,
mvdan
July 26, 2017, 8:04pm
2
Hi Sean,
This is not possible at the moment. Not specifying a version will always result in a “Version information not found” error.
The only case under which the gateway selects a version on its own is when the endpoint isn’t versioned, which isn’t very helpful here.
I’ve opened an issue here, where you can track design and progres: Add a way to define a default API version for when none is requested · Issue #955 · TykTechnologies/tyk · GitHub
Please do comment there if you think the design has any shortcomings or if it doesn’t solve what you were after.
Thanks!
Martin
July 26, 2017, 10:42pm
3
Just to add to this, until we have a feature in place, you could use a JavaScript (or any) middleware in the PRE
(pre-processing) phase to add a default header if it does not exist.
Martin
July 26, 2017, 10:54pm
4
(Of course this would be problematic on cloud!)