router/prototype.go

45 lines
762 B
Go
Raw Normal View History

2024-10-07 21:39:42 +00:00
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
2024-10-07 22:14:34 +00:00
Error() string
2024-10-07 21:39:42 +00:00
}
type PrototypeErrorResponse interface {
ErrorResponse() ErrorResponse
AllowedError() ErrorResponse
ReadError() ErrorResponse
ParseError() ErrorResponse
}
type Prototype struct {
PrototypeRequest
PrototypeResponse
PrototypeErrorResponse
}