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

Request and Writer Getters in Context #4136

Open
grachevko opened this issue Jan 9, 2025 · 0 comments
Open

Request and Writer Getters in Context #4136

grachevko opened this issue Jan 9, 2025 · 0 comments

Comments

@grachevko
Copy link

Description

While implementing middlewares as a separate module it require to add go-gin as direct dependncy.
Having getters will be able to define interface on client side https://100go.co/#interface-on-the-producer-side-6

That allow to provide implementation to client, but without unnecessary dependencies in case of client doesn't need it

How to reproduce

package middleware

import "net/http"


type Context interface {
	GetRequest() *http.Request
}

func (m *Middleware) HTTPMiddleware(c Context) {
	logger.Info("request", log.String("method", c.GetRequest().Method))
	c.Next()
}

#2281

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

No branches or pull requests

1 participant