testhttpd

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFileServerWithHeader

func NewFileServerWithHeader(t *testing.T, filename string, headers map[string]string) (*httptest.Server, func())

NewFileServerWithHeader creates a test HTTP server that serves a single file with custom headers. It returns the server and a cleanup function that should be deferred.

Example usage:

headers := map[string]string{"Content-Type": "application/json"}
server, cleanup := NewFileServerWithHeader(t, "testdata/example.json", headers)
defer cleanup()

Types

This section is empty.

Jump to

Keyboard shortcuts

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