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()
}

https://github.com/gin-gonic/gin/pull/2281