httpservice

package
v0.0.0-...-a902961 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2015 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do(s HttpService, ctx context.Context) error

func NewCancellationFilter

func NewCancellationFilter() saola.Filter

func NewRequestLogFilter

func NewRequestLogFilter(f func(e LogEntry)) saola.Filter

func NewResponseStatsFilter

func NewResponseStatsFilter(stats stats.StatsReceiver) saola.Filter

func NewStdRequestLogFilter

func NewStdRequestLogFilter() saola.Filter

func Serve

func Serve(addr string, s saola.Service) error

func WithParams

func WithParams(ctx context.Context, p Params) context.Context

func WithServerRequest

func WithServerRequest(ctx context.Context, w http.ResponseWriter, r *http.Request) context.Context

Types

type CancellableRoundTripper

type CancellableRoundTripper interface {
	http.RoundTripper
	CancelRequest(*http.Request)
}

type Client

type Client struct {
	Filter saola.Filter

	Transport CancellableRoundTripper
	// contains filtered or unexported fields
}

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request) (*http.Response, error)

type ClientRequest

type ClientRequest struct {
	Request  *http.Request
	Response *http.Response
}

func GetClientRequest

func GetClientRequest(ctx context.Context) *ClientRequest

type Endpoint

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

func NewEndpoint

func NewEndpoint() *Endpoint

func (*Endpoint) Do

func (e *Endpoint) Do(ctx context.Context) error

func (*Endpoint) DoHTTP

func (*Endpoint) GET

func (e *Endpoint) GET(path string, s saola.Service)

func (*Endpoint) Name

func (e *Endpoint) Name() string

func (*Endpoint) POST

func (e *Endpoint) POST(path string, s saola.Service)

func (*Endpoint) PUT

func (e *Endpoint) PUT(path string, s saola.Service)

type FuncService

type FuncService func(ctx context.Context, w http.ResponseWriter, r *http.Request) error

func (FuncService) Do

func (f FuncService) Do(ctx context.Context) error

func (FuncService) DoHTTP

func (FuncService) Name

func (f FuncService) Name() string

type HttpService

type HttpService interface {
	DoHTTP(ctx context.Context, w http.ResponseWriter, r *http.Request) error
	saola.Service
}

type LogEntry

type LogEntry struct {
	RemoteAddr    string
	RequestTime   time.Time
	RequestMethod string
	RequestPath   string
	StatusCode    int
	Latency       time.Duration
}

type Params

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

func EmptyParams

func EmptyParams() Params

func GetParams

func GetParams(ctx context.Context) Params

func (Params) Get

func (p Params) Get(key string) string

func (*Params) Set

func (p *Params) Set(key, value string)

type ResponseWriter

type ResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

func NewResponseWriter

func NewResponseWriter(w http.ResponseWriter) *ResponseWriter

func (*ResponseWriter) CloseNotify

func (w *ResponseWriter) CloseNotify() <-chan bool

func (*ResponseWriter) Flush

func (w *ResponseWriter) Flush()

func (*ResponseWriter) StatusCode

func (w *ResponseWriter) StatusCode() int

func (*ResponseWriter) WriteHeader

func (w *ResponseWriter) WriteHeader(code int)

type ServerRequest

type ServerRequest struct {
	Writer  http.ResponseWriter
	Request *http.Request
}

func GetServerRequest

func GetServerRequest(ctx context.Context) *ServerRequest

type StatusCodeInterceptor

type StatusCodeInterceptor interface {
	StatusCode() int
}

Jump to

Keyboard shortcuts

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