Skip to content
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

Forward http headers from clients to server #20

Closed
danikula opened this issue Sep 30, 2015 · 5 comments
Closed

Forward http headers from clients to server #20

danikula opened this issue Sep 30, 2015 · 5 comments
Assignees
Milestone

Comments

@danikula
Copy link
Owner

No description provided.

@lucas34
Copy link
Contributor

lucas34 commented Sep 23, 2016

Hi,

In order to use your library I need this feature.
Let me throw idea on this post.

Structure like follow
Topic

  • Prop 1
  • Prop 2

Goal : Passing simple parameters in the header for the request to the server.

Header structure.

  • Create our own Header class (Maybe be redondant with other libs)
  • Use a simple "Map<String, String>".

How to inject

  • Inside the builder (cannot modify base on url but easier to implement)
  • Having a callback before each request with the url and return an array of headers.

I prefer the second one because it gives more flexibility.
We can add on the builder something like

java builder.addHeadersInjector(new HeaderInjector() { @Override Map<String, String> inject(String url) { return createMyHeaderForThisUrl(url); } })

When to call

  • Only call when the request is done against the real (online) server.
  • All the time

Headers conflict

  • The library should override the headers injected by the client.

Feel free to comment or throw more ideas.
Lucas.

@danikula
Copy link
Owner Author

@lucas34 this is a great plan! It should really be implemented this way. Can you make PR?

@danikula
Copy link
Owner Author

Also we must write tests to check

  • are headers really added to http request?
  • does library override custom headers?
  • null HeaderInjector isn't accepted in builder

Also we should use empty implementation of HeaderInjector to avoid null checks.

@danikula
Copy link
Owner Author

lucas34 implementation is a good start point.

@danikula danikula added this to the 2.8.0 milestone May 18, 2017
danikula pushed a commit that referenced this issue May 18, 2017
@danikula
Copy link
Owner Author

I merged @lucas34 implementation to the master. Will be available in 2.8.0

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

No branches or pull requests

2 participants