metaverse / truss

Truss helps you build go-kit microservices without having to worry about writing or maintaining boilerplate code.
Other
734 stars 143 forks source link

HTTP request method in context #341

Open JianleiZhang opened 2 years ago

JianleiZhang commented 2 years ago

I want to use the middleware casbin. Can I use the request method as the casbin action?

JianleiZhang commented 2 years ago

I add this code in transport_http.go, but I think this file should not be edited manually.

    // Tune specific change.
    // also add the request url
    ctx = context.WithValue(ctx, "request-url", r.URL.Path)
    ctx = context.WithValue(ctx, "transport", "HTTPJSON")
    ctx = context.WithValue(ctx, "method", r.Method)