Documentation
¶
Overview ¶
Package tgbottest provides a local fake Telegram Bot API server for tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrClosed = errors.New("fake Telegram API server is closed")
ErrClosed is returned when a response is queued after the server is closed.
Functions ¶
This section is empty.
Types ¶
type Envelope ¶
type Envelope struct {
OK bool `json:"ok"`
Result any `json:"result,omitempty"`
ErrorCode int `json:"error_code,omitempty"`
Description string `json:"description,omitempty"`
Parameters any `json:"parameters,omitempty"`
}
Envelope represents a Telegram Bot API response envelope.
type Option ¶
type Option func(*Server)
Option configures a fake Telegram API server.
func WithRequestBodyLimit ¶
WithRequestBodyLimit sets the maximum captured request body size.
type Request ¶
type Request struct {
Method string
HTTPMethod string
ContentType string
JSON map[string]any
Fields map[string]string
Files map[string]File
DecodeError string
}
Request is a captured Telegram Bot API request.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a closeable, concurrency-safe fake Telegram Bot API server.
func (*Server) Close ¶
func (server *Server) Close()
Close stops the server. It is safe to call Close more than once.
Click to show internal directories.
Click to hide internal directories.