Documentation ¶
Overview ¶
Package httpadapter provides support for handling resource calls using an http.Handler.
Example ¶
handler := New(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { _, err := rw.Write([]byte("Hello world!")) if err != nil { return } rw.WriteHeader(http.StatusOK) })) _ = backend.ServeOpts{ CallResourceHandler: handler, }
Output:
Example (Serve_mux) ¶
mux := http.NewServeMux() mux.HandleFunc("/hello", func(rw http.ResponseWriter, req *http.Request) { _, err := rw.Write([]byte("Hello world!")) if err != nil { return } rw.WriteHeader(http.StatusOK) }) handler := New(mux) _ = backend.ServeOpts{ CallResourceHandler: handler, }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(handler http.Handler) backend.CallResourceHandler
New creates a new backend.CallResourceHandler adapter for handling resource calls using an http.Handler
func PluginConfigFromContext ¶
func PluginConfigFromContext(ctx context.Context) backend.PluginConfig
PluginConfigFromContext returns backend.PluginConfig from context.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.