testdoc

package
Version: v0.0.0-...-d322088 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	RequestKind  = "Request"
	ResponseKind = "Response"
)
View Source
const APIBlueprintFormat = "1A"

Variables

This section is empty.

Functions

func CommaJoinStrs

func CommaJoinStrs(args ...interface{}) string

func IndentJSONBody

func IndentJSONBody(args ...interface{}) string

Types

type APIDescription

type APIDescription struct {
	APIBlueprintFormat string
	HostURL            string
	Title              string
	Description        string
}

type APIDoc

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

func NewAPIDoc

func NewAPIDoc(filePath string, desc *APIDescription) *APIDoc

func (*APIDoc) RecordRequest

func (doc *APIDoc) RecordRequest(r *http.Request) (err error)

func (*APIDoc) RecordResponse

func (doc *APIDoc) RecordResponse(r *http.Request, handler http.Handler) (resp *httptest.ResponseRecorder, err error)

func (*APIDoc) WriteBody

func (doc *APIDoc) WriteBody(jsonBody string) (err error)

func (*APIDoc) WriteDescription

func (doc *APIDoc) WriteDescription() (err error)

func (*APIDoc) WriteGroup

func (doc *APIDoc) WriteGroup(group TestGroup) (err error)

func (*APIDoc) WriteHeaders

func (doc *APIDoc) WriteHeaders(headers map[string][]string) (err error)

func (*APIDoc) WriteRequestTitle

func (doc *APIDoc) WriteRequestTitle(description string) (err error)

func (*APIDoc) WriteResponseTitle

func (doc *APIDoc) WriteResponseTitle(code int, contentType string) (err error)

type BaseURISet

type BaseURISet struct {
	CollectionRoute string // eg. /gists
	SingularRoute   string // eg. /gists/{id}
}

type Group

type Group struct {
	Title       string // eg. Gists
	Description string
}

func (*Group) GetDescription

func (g *Group) GetDescription() string

func (*Group) GetTitle

func (g *Group) GetTitle() string

type PropertySet

type PropertySet interface {
	List() string
}

type RequestProperties

type RequestProperties struct {
	Description string
}

func (*RequestProperties) List

func (p *RequestProperties) List() string

type ResponseProperties

type ResponseProperties struct {
	StatusCode  int
	ContentType string
}

func (*ResponseProperties) List

func (p *ResponseProperties) List() string

type TestGroup

type TestGroup interface {
	GetTitle() string
	GetDescription() string
}

type Title

type Title struct {
	Kind       string
	Properties PropertySet
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL