Martti T.
Martti T.
Why do you need to use httpsnoop? You can get same data without using it. See how logging middleware is able to get same/similar data with Echo https://github.com/labstack/echo/blob/f20820c0030a0d8c8aa20f63996092faa329fe03/middleware/logger.go#L114 but you...
you probably should mention what metrics library are you trying to wrap. It would make probably more sense to convert that part to Echo middleware (assuming it is not huge...
This is probably what you search but it really feels like pushing square peg through round hole. ```go func TestEchoWrapMiddleware(t *testing.T) { e := echo.New() var sizeFromMW int64 var statusFromMW...
I am not sure if it makes sense to add this. It takes only 2 extra lines (~60 characters) to have same functionality with handler and handler allows you to...
Yes, `File()` exists and `Attachment` would be very similar. Main difference is that `File` is already part of API and part of contract library needs to maintain. I personally would...
Lets not close this yet. I feel like I am the party pooper here. It would be definitively useful for some use-cases and would not be something directly negative of...
If all your responses are same (non-default content-type) then you could use custom `echo.JSONSerializer` and change the content-type there. Search for https://github.com/labstack/echo/search?q=JSONSerializer (probably/should work) This works as https://github.com/labstack/echo/blob/feaa6ede6a4bbe4a0f25e8fed022868134ccbc6b/context.go#L482-L486
and there is no shame to have you own application specific utility functions.
If all of your handlers respond with siren you could do ```go type MyJSONSerializer struct { echo.DefaultJSONSerializer } func (d MyJSONSerializer) Serialize(c echo.Context, i interface{}, indent string) error { c.Response().Header().Set(echo.HeaderContentType,...
I think I understand the reasoning here - for this usecase `ResponseMessage` and `c.RespondWith(http.StatusOK, echo.JSONResponse(payload))` seem eloquent solution but 99% of cases this is overkill and unnecessary. Moreover - you...