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

Adds RequestIDHandler function to RequestID middleware #1898

Merged
merged 1 commit into from
Jul 5, 2021

Conversation

zacscoding
Copy link
Contributor

Adds RequestIDHandler function in RequestID middleware to use the value.
For example, suppose we want to use RequestID value in logger after extract.

e.Use(RequestIDWithConfig(RequestIDConfig{
	RequestIDHandler: func(ctx echo.Context, requestID string) {
		logger := logging.DefaultLogger().With("x-request-id", requestID)
		ctx.SetRequest(ctx.Request().WithContext(logging.WithLogger(logger)))
	},
}))

@codecov
Copy link

codecov bot commented Jul 5, 2021

Codecov Report

Merging #1898 (78a0ea2) into master (1ac4a8f) will increase coverage by 0.33%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1898      +/-   ##
==========================================
+ Coverage   90.61%   90.94%   +0.33%     
==========================================
  Files          31       31              
  Lines        2782     2784       +2     
==========================================
+ Hits         2521     2532      +11     
+ Misses        168      161       -7     
+ Partials       93       91       -2     
Impacted Files Coverage Δ
middleware/request_id.go 84.21% <100.00%> (+1.85%) ⬆️
router.go 95.69% <0.00%> (+0.66%) ⬆️
echo.go 93.80% <0.00%> (+2.16%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1ac4a8f...78a0ea2. Read the comment docs.

@aldas aldas merged commit fd7a8a9 into labstack:master Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants