router/prototype.go

37 lines
695 B
Go

package router
import "io"
type RequestBuilder interface {
Allowed(method string) (errRes ErrorResponse)
Header(header Header) (errRes ErrorResponse)
ReadBody(body io.ReadCloser) (errRes ErrorResponse)
Values(values Values) (errRes ErrorResponse)
}
type PrototypeRequestBuilder interface {
RequestBuilder() (req RequestBuilder)
}
type Response interface {
Header() (header Header)
Bytes() (body []byte)
}
type PrototypeResponse interface {
Response() (res Response)
}
type ErrorResponse interface {
Ok() (ok bool)
HttpStatus() (code int)
Bytes() (body []byte)
String() (out string)
Error() (out string)
}
type Prototype struct {
PrototypeRequestBuilder
PrototypeResponse
}