44 lines
746 B
Go
44 lines
746 B
Go
package router
|
|
|
|
import "io"
|
|
|
|
type Request interface {
|
|
Allowed(method string) ErrorResponse
|
|
Header() Header
|
|
ReadBody(body io.ReadCloser) ErrorResponse
|
|
ParseForm(values map[string][]string) ErrorResponse
|
|
}
|
|
|
|
type PrototypeRequest interface {
|
|
Request() Request
|
|
}
|
|
|
|
type Response interface {
|
|
Header() Header
|
|
Response() (body []byte)
|
|
}
|
|
|
|
type PrototypeResponse interface {
|
|
Response() Response
|
|
}
|
|
|
|
type ErrorResponse interface {
|
|
Ok() bool
|
|
HttpStatus() int
|
|
ErrorResponse() []byte
|
|
String() string
|
|
}
|
|
|
|
type PrototypeErrorResponse interface {
|
|
ErrorResponse() ErrorResponse
|
|
AllowedError() ErrorResponse
|
|
ReadError() ErrorResponse
|
|
ParseError() ErrorResponse
|
|
}
|
|
|
|
type Prototype struct {
|
|
PrototypeRequest
|
|
PrototypeResponse
|
|
PrototypeErrorResponse
|
|
}
|