HTTPContext
Request Context
Work with request, response, endpoint, and per-request values.
http.Context is created for each request. It follows Go context behavior
through methods such as Deadline, Done, Err, and Value, then adds
HTTP-specific request and response access.
func (c *UserController) getUser(ctx *http.Context) (http.Result, error) {
id := ctx.Request().PathValue("id")
ctx.Response().SetHeader("Cache-Control", "no-store")
user, err := c.service.Find(ctx, id)
if err != nil {
return nil, err
}
return http.TypedResult[UserDTO]{Body: user}, nil
}Use Request() for inbound data and Response() for outbound response state.
