Procyon|Docs
HTTPHandlers

Typed Context

Receive parsed request input through EndpointContext.

Handlers can use typed endpoint contexts when route input should be bound into a Go value.

context.go
type EndpointContext[I any] struct {
	// Input returns parsed request data.
}

Use it when handler input has a clear schema.

users.go
type CreateUserInput struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

func (c *UserController) createUser(
	ctx *http.EndpointContext[CreateUserInput],
) (http.Result, error) {
	input := ctx.Input()
	user, err := c.service.Create(ctx, input)
	if err != nil {
		return nil, err
	}

	return http.TypedResult[UserDTO]{
		Body:   user,
		Status: http.StatusCreated,
	}, nil
}

Typed contexts still expose request context behavior, request access, response access, and the underlying native context when needed.