github.com/yandex/pandora@v0.5.32/components/providers/http/import.go (about) 1 package http 2 3 import ( 4 "github.com/spf13/afero" 5 "github.com/yandex/pandora/components/providers/http/config" 6 "github.com/yandex/pandora/components/providers/http/middleware" 7 headerdate "github.com/yandex/pandora/components/providers/http/middleware/headerdate" 8 httpRegister "github.com/yandex/pandora/components/providers/http/register" 9 "github.com/yandex/pandora/core" 10 "github.com/yandex/pandora/core/register" 11 ) 12 13 func Import(fs afero.Fs) { 14 register.Provider("http", func(cfg config.Config) (core.Provider, error) { 15 return NewProvider(fs, cfg) 16 }) 17 18 register.Provider("http/json", func(cfg config.Config) (core.Provider, error) { 19 cfg.Decoder = config.DecoderJSONLine 20 return NewProvider(fs, cfg) 21 }) 22 23 register.Provider("uri", func(cfg config.Config) (core.Provider, error) { 24 cfg.Decoder = config.DecoderURI 25 return NewProvider(fs, cfg) 26 }) 27 28 register.Provider("uripost", func(cfg config.Config) (core.Provider, error) { 29 cfg.Decoder = config.DecoderURIPost 30 return NewProvider(fs, cfg) 31 }) 32 33 register.Provider("raw", func(cfg config.Config) (core.Provider, error) { 34 cfg.Decoder = config.DecoderRaw 35 return NewProvider(fs, cfg) 36 }) 37 38 httpRegister.HTTPMW("header/date", func(cfg headerdate.Config) (middleware.Middleware, error) { 39 return headerdate.NewMiddleware(cfg) 40 }) 41 42 }