common

package
v0.0.0-...-48d2764 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddNATSPublishVarsToReplacer

func AddNATSPublishVarsToReplacer(repl *caddy.Replacer, req *http.Request)

func AddNatsSubscribeVarsToReplacer

func AddNatsSubscribeVarsToReplacer(repl *caddy.Replacer, msg *nats.Msg)

func NatsMsgForHttpRequest

func NatsMsgForHttpRequest(r *http.Request, subject string) (*nats.Msg, error)

NatsMsgForHttpRequest creates a nats.Msg from an existing http.Request: the HTTP Request Body is transferred to the NATS message Data, and the headers are transferred as well.

Three special headers are added for the request method, URL path, and raw query.

Types

type ExtraNatsMsgHeaders

type ExtraNatsMsgHeaders map[string]string

func ExtraNatsMsgHeadersFromContext

func ExtraNatsMsgHeadersFromContext(ctx context.Context) ExtraNatsMsgHeaders

func (ExtraNatsMsgHeaders) StoreInCtx

type NatsHandler

type NatsHandler interface {
	Subscribe(conn *nats.Conn) error
	Unsubscribe(conn *nats.Conn) error
}

type NoopResponseWriter

type NoopResponseWriter struct {
	// contains filtered or unexported fields
}

func (NoopResponseWriter) Header

func (n NoopResponseWriter) Header() http.Header

func (NoopResponseWriter) Write

func (NoopResponseWriter) Write(p []byte) (int, error)

func (NoopResponseWriter) WriteHeader

func (NoopResponseWriter) WriteHeader(statusCode int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL