feat: adding params
This commit is contained in:
@@ -23,6 +23,7 @@ func (w bodyWriter) Write(b []byte) (int, error) {
|
|||||||
w.body.Write(b)
|
w.body.Write(b)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
w.bytes += len(b)
|
w.bytes += len(b)
|
||||||
return w.ResponseWriter.Write(b)
|
return w.ResponseWriter.Write(b)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,6 +104,11 @@ func NewWithConfig(logger *slog.Logger, config Config) gin.HandlerFunc {
|
|||||||
path := c.Request.URL.Path
|
path := c.Request.URL.Path
|
||||||
query := c.Request.URL.RawQuery
|
query := c.Request.URL.RawQuery
|
||||||
|
|
||||||
|
params := map[string]string{}
|
||||||
|
for _, p := range c.Params {
|
||||||
|
params[p.Key] = p.Value
|
||||||
|
}
|
||||||
|
|
||||||
requestID := uuid.New().String()
|
requestID := uuid.New().String()
|
||||||
if config.WithRequestID {
|
if config.WithRequestID {
|
||||||
c.Set(requestIDCtx, requestID)
|
c.Set(requestIDCtx, requestID)
|
||||||
@@ -138,6 +143,7 @@ func NewWithConfig(logger *slog.Logger, config Config) gin.HandlerFunc {
|
|||||||
slog.String("host", host),
|
slog.String("host", host),
|
||||||
slog.String("path", path),
|
slog.String("path", path),
|
||||||
slog.String("query", query),
|
slog.String("query", query),
|
||||||
|
slog.Any("params", params),
|
||||||
slog.String("route", route),
|
slog.String("route", route),
|
||||||
slog.String("ip", ip),
|
slog.String("ip", ip),
|
||||||
slog.String("referer", referer),
|
slog.String("referer", referer),
|
||||||
|
|||||||
Reference in New Issue
Block a user