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

Identify a way to pass req to remote service. #2

Open
SomeoneWeird opened this issue Sep 15, 2016 · 1 comment
Open

Identify a way to pass req to remote service. #2

SomeoneWeird opened this issue Sep 15, 2016 · 1 comment

Comments

@SomeoneWeird
Copy link
Member

Sometimes it's useful being able to access properties of the client request (ip, cookies etc) in the service doing the work.

There's a few ways I think this can be done, all of them breaking. Can't think of any that aren't.

The best one that I've come up with so far is (on the ht service side)

...
import hte from 'ht-express'
...

service.before(hte.handleRequests())

...

service.on('requiresCookies', s.Object({
  hte: hte.Request()
}, ...

Change the hte client to always send the req over the wire
The middleware can introspect the method that will be called, and check if it has a key called hte in it's schema, if not, it can remove it from the data and continue.

Downside is it will massively inflate the packet size of each request.

@SomeoneWeird SomeoneWeird changed the title Identify a way to pass req to remove service. Identify a way to pass req to remote service. Sep 15, 2016
@timmyw
Copy link
Contributor

timmyw commented Sep 15, 2016

What requirements will this solution have in the HT component (i.e. does it require knowledge in vanilla hudson-taylor of what the ht-express component is doing?

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