Skip to content

use headers to provide title and description params#5

Open
groob wants to merge 1 commit into
s-mang:masterfrom
groob:use_header
Open

use headers to provide title and description params#5
groob wants to merge 1 commit into
s-mang:masterfrom
groob:use_header

Conversation

@groob

@groob groob commented Oct 18, 2016

Copy link
Copy Markdown
Contributor

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.

Adds two headers X-Test2Doc-Description and
X-Test2Doc-Title to as an alternative to GetTitle and
GetDescription methods.
@s-mang

s-mang commented Oct 28, 2016

Copy link
Copy Markdown
Owner

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.

@olivoil

olivoil commented Aug 2, 2017

Copy link
Copy Markdown

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants