You can do whatever you want with Iris, just accept the header and switch logic inside your handler, we can't implement everything here but I always liked this (although versioning can be done with Party("/v1" for example, a path prefix) so I am willing to discuss it for a built'n feature.
Give us an example code, how you imagine it? I can contribute to your idea by providing an API and make it reality.
i.e, via app.Get("/path", handler).Version("1.0") (Get/Post and so on returns the *Route so we can do that like this) or:
app.Get('/path', iris.Versioning(iris.Map{"1.0": v1Handler, "~2.1.0": v2Handler, "default (or not found we will see)": unknownVersionHandler}))
// we can have a middleware to set a custom version getter as well, i.e:
// ctx.Values().Set("version", valueFromHeaderOrURLParam)
// to customize the version
or something else inside the handler itself? You name it
Yes. In the short term I'm planning to get the header and then use switch. A cleaner solution would indeed be to add to the Party functionality.
I'll have to think some more on this, but I think the version is :ok: to stay within the scope of Party.
Meanwhile, I am coding it and I will give you an example code which will work for both specific routes and group of them so we can compare our thoughts and find the most decent solution for this, sounds ok?
@chiquitawow You can see the progress at: https://github.com/kataras/iris/pull/1130, you can also fork the repo and work on that branch as well to push your own ideas but please discuss here first.
The current implementation (which is not ready yet, just a proposal) contains:
Looks good. Thanks for the initial POC. I'll take a look at the implementation soon.