2024-10-07 21:39:42 +00:00
|
|
|
package router
|
|
|
|
|
|
|
|
import "io"
|
|
|
|
|
2024-10-08 21:57:25 +00:00
|
|
|
type RequestBuilder interface {
|
2024-10-08 22:18:16 +00:00
|
|
|
Allowed(method string) (errRes ErrorResponse)
|
|
|
|
Header(header Header) (errRes ErrorResponse)
|
|
|
|
Body(body io.ReadCloser) (errRes ErrorResponse)
|
|
|
|
Values(values Values) (errRes ErrorResponse)
|
2024-10-07 21:39:42 +00:00
|
|
|
}
|
|
|
|
|
2024-10-08 21:57:25 +00:00
|
|
|
type PrototypeRequestBuilder interface {
|
2024-10-08 22:18:16 +00:00
|
|
|
RequestBuilder() (req RequestBuilder)
|
2024-10-07 21:39:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Response interface {
|
2024-10-08 22:18:16 +00:00
|
|
|
Header() (header Header)
|
|
|
|
Bytes() (body []byte)
|
2024-10-07 21:39:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type PrototypeResponse interface {
|
2024-10-08 22:18:16 +00:00
|
|
|
Response() (res Response)
|
2024-10-07 21:39:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type ErrorResponse interface {
|
2024-10-08 22:18:16 +00:00
|
|
|
Ok() (ok bool)
|
|
|
|
HttpStatus() (code int)
|
|
|
|
Bytes() (body []byte)
|
|
|
|
String() (out string)
|
|
|
|
Error() (out string)
|
2024-10-07 21:39:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type PrototypeErrorResponse interface {
|
2024-10-08 22:18:16 +00:00
|
|
|
ErrorResponse() (errRes ErrorResponse)
|
2024-10-07 21:39:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Prototype struct {
|
2024-10-08 22:18:16 +00:00
|
|
|
req PrototypeRequestBuilder
|
|
|
|
res PrototypeResponse
|
|
|
|
errRes PrototypeErrorResponse
|
2024-10-07 21:39:42 +00:00
|
|
|
}
|