// create a new context ctx := context.NewContext() // create a new HTTP request req, err := http.NewRequest("GET", "http://example.com", nil) if err != nil { // handle error } // set the HTTP request in the context ctx.SetRequest(req) // retrieve the HTTP request from the context reqFromCtx := ctx.Request()
// create a new context ctx := context.NewContext() // set a key-value pair in the context ctx.Set("userId", "123") // retrieve the value of the key from the context userId := ctx.Value("userId").(string)In this example, a key-value pair is set in the context using the `Set` method. The `Value` method is then used to retrieve the value of the key from the context. The `github.com/stretchr/goweb/context` package is a part of the `goweb` web framework for Go. It provides a convenient way to store and retrieve information in the context of an HTTP request.