New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set HTTP header on the client side without an explicit swagger parameters #935

Closed
frosenberg opened this Issue Feb 16, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@frosenberg
Copy link

frosenberg commented Feb 16, 2017

Problem statement

We have a need to set HTTP header parameters in the (generated) client code that are not necessarily part of the swagger documentation. We know that we could specify the header parameter in swagger but that is not feasible as it should not be exposed to the public users (it will be set automatically by the gateway but for internal development we also want to set it).

However, I don't really have access to the http request from any of the Params object. Unless I'm missing something, I would have to make a copy of the swagger doc with the parameter that I then use for client code generation and one for external use without the parameter.

Is there a better way to solve this by letting met set custom headers that are not specified in the swagger document? Alternative would be hidden parameters in the swagger doc but I don't think that exists.

@casualjim

This comment has been minimized.

Copy link
Member

casualjim commented Feb 16, 2017

You can use a roundtripper for this purpose, see here: #911

@frosenberg

This comment has been minimized.

Copy link

frosenberg commented Feb 16, 2017

Awesome, i'll look into this. Always appreciate your fast response :).

@frosenberg

This comment has been minimized.

Copy link

frosenberg commented Feb 20, 2017

This resolved my problem and this issue can be closed.

@casualjim casualjim closed this Feb 20, 2017

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