test2doc
test2doc copied to clipboard
use headers to provide title and description params
This PR adds the ability to set the Description
and Title
used by test2doc by setting custom request headers.
Sometimes the HTTP Handler is not a function or method in the code, but is created using a factory function.
This is an interesting idea. But it does take away a lot from the simplicity and intention of the project. I think I'll leave it here for folks to upvote. If anyone else would use this feature, I'll think more seriously about merging.
Thanks for breaking all these changes up into many PRs.
I use gokit.io to generate the handlers, so it looks something like this:
r.Methods("POST").Path("/profiles/").Handler(httptransport.NewServer(
e.PostProfileEndpoint,
decodePostProfileRequest,
encodeResponse,
options...,
))
I love the simplicity of test2doc, but maybe custom headers are a good compromise to give it more flexibility?