2019-06-02 00:28:22 +09:00

25 lines
482 B
Go

package middleware
import (
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
)
// OpenGraphContext is a context with open graph data.
type OpenGraphContext struct {
aero.Context
*arn.OpenGraph
}
// OpenGraph middleware modifies the context to be an OpenGraphContext.
func OpenGraph(next aero.Handler) aero.Handler {
return func(ctx aero.Context) error {
openGraphCtx := &OpenGraphContext{
Context: ctx,
OpenGraph: nil,
}
return next(openGraphCtx)
}
}