httpruntime

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 11, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

SetError is used to output errors to the client. You can override that in the runtime.

Functions

func DefaultSetError

func DefaultSetError(ctx context.Context, req *http.Request, w http.ResponseWriter, err error, data map[string]string)

DefaultSetError is the default error output.

func MarshalerForRequest

func MarshalerForRequest(r *http.Request) (Marshaler, Marshaler)

MarshalerForRequest returns marshalers for inbound and outbound bodies.

func OverrideMarshaler

func OverrideMarshaler(contentType string, m Marshaler)

OverrideMarshaler replaces marshaler for given content-type.

Types

type Marshaler

type Marshaler interface {
	ContentType() string
	Unmarshal(io.Reader, proto.Message) error
	Marshal(io.Writer, proto.Message) error
}

type MarshalerPbJSON

type MarshalerPbJSON struct {
	Marshaler       *jsonpb.Marshaler
	Unmarshaler     *jsonpb.Unmarshaler
	GogoMarshaler   *gogojsonpb.Marshaler
	GogoUnmarshaler *gogojsonpb.Unmarshaler
}

func (MarshalerPbJSON) ContentType

func (MarshalerPbJSON) ContentType() string

func (MarshalerPbJSON) Marshal

func (m MarshalerPbJSON) Marshal(w io.Writer, src proto.Message) error

func (MarshalerPbJSON) Unmarshal

func (m MarshalerPbJSON) Unmarshal(r io.Reader, dst proto.Message) error

Jump to

Keyboard shortcuts

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