-
Notifications
You must be signed in to change notification settings - Fork 0
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
dispatchserver package #3
Conversation
dispatchserver/endpoint.go
Outdated
} | ||
|
||
// Run sends a RunRequest and returns a RunResponse. | ||
func (c *EndpointClient) Run(ctx context.Context, header http.Header, req dispatch.Request) (dispatch.Response, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered making the header part of the dispatch.Request
type instead of passing it into the function each time?
If we don't have a use case for configuring the header differently on each request it could also be a property of EndpointClient
to take it out of the Run
method signature.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See dc653d6.
We have a use case upstream where we need to change the header on each request, but we also need to change the signing key too, which is currently set via an option 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice work 🙌
This adds a
dispatchserver
package for use by Dispatch itself when serving its API, and when making requests to an endpoint. Having the server and client live in this repo allows us to use higher level interfaces everywhere, and consolidate request signature generation and validation here (without opening up theinternal/auth
package).There were two components from the
dispatchtest
package that I've repurposed for the task.