router/prototype.go
2024-10-07 18:14:34 -04:00

45 lines
762 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
Error() string
}
type PrototypeErrorResponse interface {
ErrorResponse() ErrorResponse
AllowedError() ErrorResponse
ReadError() ErrorResponse
ParseError() ErrorResponse
}
type Prototype struct {
PrototypeRequest
PrototypeResponse
PrototypeErrorResponse
}