testserver

package
v1.0.0-pre.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2025 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateServer

func CreateServer(opts ...Option) (*httptest.Server, error)

CreateServer creates a new test server with the provided options. The options are very useful to pass in unique configurations, custom mocks, or other settings.

Types

type Option

type Option func(*testServerConfig)

Option is a function that modifies the server configuration.

func CaptureLogToWriter

func CaptureLogToWriter(w io.Writer) Option

CaptureLogToWriter is an option that allows the caller to capture the log output from the server to a writer. This is useful for testing the log output of the server inside the tests, if needed.

func WithAPIBundle

func WithAPIBundle(bundle ponrunner.APIBundle) Option

WithAPIBundle allows the caller to pass in a custom API bundle to the server. If one API bundle is provided, it will overwrite the default API bundles. If multiple API bundles are provided, they will be appended.

func WithConfig

func WithConfig(cfg configura.Config) Option

WithConfig allows the caller to pass in a custom configuration for the server from an existing configura.Config.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL