context3

package
v0.0.0-...-d011049 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Server

func Server(store Store) http.HandlerFunc

Server returns a handler for calling Store.

Types

type SpyResponseWriter

type SpyResponseWriter struct {
	// contains filtered or unexported fields
}

SpyResponseWriter checks whether a response has been written.

func (*SpyResponseWriter) Header

func (s *SpyResponseWriter) Header() http.Header

Header will mark written to true.

func (*SpyResponseWriter) Write

func (s *SpyResponseWriter) Write([]byte) (int, error)

Write will mark written to true.

func (*SpyResponseWriter) WriteHeader

func (s *SpyResponseWriter) WriteHeader(statusCode int)

WriteHeader will mark written to true.

type SpyStore

type SpyStore struct {
	// contains filtered or unexported fields
}

SpyStore allows you to simulate a store and see how its used.

func (*SpyStore) Fetch

func (s *SpyStore) Fetch(ctx context.Context) (string, error)

Fetch returns response after a short delay.

type Store

type Store interface {
	Fetch(ctx context.Context) (string, error)
}

Store fetches data.

Jump to

Keyboard shortcuts

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