mirror of
https://github.com/kataras/iris.git
synced 2025-12-18 02:17:05 +00:00
use the new protobuf package and other minor stuff
Former-commit-id: 29bf71e8a73d34b27c6f5fe3f12c4ea1cc2b84b2
This commit is contained in:
@@ -42,10 +42,11 @@ func TestFromStdWithNext(t *testing.T) {
|
||||
basicauth := "secret"
|
||||
passed := "ok"
|
||||
|
||||
type contextKey string
|
||||
stdWNext := func(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
|
||||
if username, password, ok := r.BasicAuth(); ok &&
|
||||
username == basicauth && password == basicauth {
|
||||
ctx := stdContext.WithValue(r.Context(), "key", "ok")
|
||||
ctx := stdContext.WithValue(r.Context(), contextKey("key"), "ok")
|
||||
next.ServeHTTP(w, r.WithContext(ctx))
|
||||
return
|
||||
}
|
||||
@@ -54,7 +55,7 @@ func TestFromStdWithNext(t *testing.T) {
|
||||
|
||||
h := handlerconv.FromStdWithNext(stdWNext)
|
||||
next := func(ctx context.Context) {
|
||||
ctx.WriteString(ctx.Request().Context().Value("key").(string))
|
||||
ctx.WriteString(ctx.Request().Context().Value(contextKey("key")).(string))
|
||||
}
|
||||
|
||||
app := iris.New()
|
||||
|
||||
Reference in New Issue
Block a user