batch

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(namespace string, mux http.Handler) http.Handler

Handler returns a new handler.

Types

type Request

type Request struct {
	Defaults *RequestPart
	Requests []RequestPart
}

Request is a batch request.

type RequestPart

type RequestPart struct {
	Method  string            `json:"method"`
	Path    string            `json:"path"`
	Body    json.RawMessage   `json:"body"`
	Headers map[string]string `json:"headers"`
}

RequestPart contains sub-request information of a batch request.

func (*RequestPart) Norm

func (p *RequestPart) Norm(namespace string, defaults *RequestPart)

Norm merges defaults and normalizes part.

type Response

type Response struct {
	Responses []ResponsePart `json:"responses"`
}

Response is a batch response.

type ResponsePart

type ResponsePart struct {
	Status  int               `json:"status"`
	Path    string            `json:"path"`
	Body    json.RawMessage   `json:"body,omitempty"`
	Headers map[string]string `json:"headers,omitempty"`
}

ResponsePart contains sub-response information of a batch response.

type ResponseRecorder

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

ResponseRecorder records responses.

func (*ResponseRecorder) Header

func (w *ResponseRecorder) Header() http.Header

Header implements http.ResponseWriter interface.

func (*ResponseRecorder) Reset

func (w *ResponseRecorder) Reset()

Reset resets the recorder.

func (*ResponseRecorder) Write

func (w *ResponseRecorder) Write(p []byte) (int, error)

Write implements http.ResponseWriter interface.

func (*ResponseRecorder) WriteHeader

func (w *ResponseRecorder) WriteHeader(code int)

WriteHeader implements http.ResponseWriter interface.

Jump to

Keyboard shortcuts

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