Documentation ¶
Overview ¶
Package geminitest provides a test server and functions to help write tests for gemini servers.
Index ¶
- func NewRequest(target string) *gemini.Request
- type ResponseRecorder
- func (r *ResponseRecorder) Failure(ctx context.Context, code gemini.StatusCode, msg string)
- func (r *ResponseRecorder) Input(ctx context.Context, prompt string, isSensitive bool)
- func (r *ResponseRecorder) Redirect(ctx context.Context, redirectURL string, isPermanant bool)
- func (r *ResponseRecorder) Success(ctx context.Context, mimeType string) io.Writer
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ResponseRecorder ¶
type ResponseRecorder struct { Body *bytes.Buffer Meta string Code gemini.StatusCode }
ResponseRecorder may be used in test to capture the output of a Handler.
func NewResponseRecorder ¶
func NewResponseRecorder() *ResponseRecorder
NewResponseRecorder returns a response recorder ready to use.
func (*ResponseRecorder) Failure ¶
func (r *ResponseRecorder) Failure(ctx context.Context, code gemini.StatusCode, msg string)
Failure implements the Failure method of the ResponseWriter interface.
func (*ResponseRecorder) Input ¶
func (r *ResponseRecorder) Input(ctx context.Context, prompt string, isSensitive bool)
Input implements the Input method of the ResponseWriter interface.
type Server ¶
type Server struct { Listener net.Listener TLS *tls.Config Config *gemini.Server URL string Addr string // contains filtered or unexported fields }
Server is gemini server listing on a randomly chosen open port.
func NewServer ¶
NewServer returns a test server which has been started and is ready to use.
func NewUnstartedServer ¶
NewUnstartedServer returns a server which has not been started.
Click to show internal directories.
Click to hide internal directories.