adapter

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockKey

type MockKey string

Exportamos la clave y el tipo para usarlos en los tests

const MockParamsKey MockKey = "mock_params"

type MockRouter

type MockRouter struct {
	// Handlers: Mapa compartido entre grupos (por eso es un puntero a mapa si lo reinicias,
	// pero como maps son referencia, basta con pasarlo)
	Handlers map[string]http.HandlerFunc
	// contains filtered or unexported fields
}

func NewMockRouter

func NewMockRouter() *MockRouter

func (*MockRouter) DELETE

func (m *MockRouter) DELETE(path string, h http.HandlerFunc)

func (*MockRouter) GET

func (m *MockRouter) GET(path string, h http.HandlerFunc)

Verbos HTTP

func (*MockRouter) Group

func (m *MockRouter) Group(path string) internal.Router

Group: Ahora concatena el prefijo y COPIA los middlewares heredados

func (*MockRouter) HEAD

func (m *MockRouter) HEAD(path string, h http.HandlerFunc)

func (*MockRouter) Handle added in v1.0.2

func (m *MockRouter) Handle(pattern string, h http.Handler)

func (*MockRouter) HandleFunc added in v1.0.2

func (m *MockRouter) HandleFunc(pattern string, h http.HandlerFunc)

func (*MockRouter) PATCH

func (m *MockRouter) PATCH(path string, h http.HandlerFunc)

func (*MockRouter) POST

func (m *MockRouter) POST(path string, h http.HandlerFunc)

func (*MockRouter) PUT

func (m *MockRouter) PUT(path string, h http.HandlerFunc)

func (*MockRouter) Param

func (m *MockRouter) Param(r *http.Request, key string) string

Param: Lee del contexto inyectado

func (*MockRouter) Serve

func (m *MockRouter) Serve(port string) error

func (*MockRouter) ServeHTTP added in v1.0.2

func (m *MockRouter) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP permite que el MockRouter cumpla con la interfaz http.Handler. Esto es vital para usarlo con httptest.NewRecorder() y en benchmarks.

func (*MockRouter) Use

func (m *MockRouter) Use(mw internal.Middleware)

Use: Agrega middlewares a la pila actual

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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