-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
echo middleware: support being called with raw context (#10)
The echo middleware handles interacting with iam-runtime using an echo context. Results are then checked and a proper echo error is returned. However when the user has a standard context.Context instead of an echo.Context, they can no longer take advantage of the echo middleware's ability to return proper echo errors. One scenario where this may come up is when adding tracing spans to your methods. The first thing you do is create a new span which returns a standard context.Context. In order to take advantage of the echo middleware while keeping the trace context, the user would have to replace the echo.Context's request with one with the updated context. This adds unnecessary work for the user as the echo middleware simply unwraps the request context before processing it anyways. So a simple solution which simplifies usability is to simply expose a function which can act on a context.Context while still handling echo errors properly. Signed-off-by: Mike Mason <[email protected]>
- Loading branch information
Showing
2 changed files
with
32 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters