From 711e48d9ab106e39eeea4dc06383aaa8a4f8fa9c Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Sat, 3 Feb 2018 18:31:01 +0200 Subject: [PATCH] fix https://github.com/kataras/iris/issues/897 Former-commit-id: 6f94a79d9ce3ac9b2b05d1e2637059996a02df1d --- _examples/experimental-handlers/csrf/main.go | 2 +- context/context.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_examples/experimental-handlers/csrf/main.go b/_examples/experimental-handlers/csrf/main.go index e8a8bf00..20964ac0 100644 --- a/_examples/experimental-handlers/csrf/main.go +++ b/_examples/experimental-handlers/csrf/main.go @@ -44,7 +44,7 @@ func getSignupForm(ctx iris.Context) { ctx.ViewData(csrf.TemplateTag, csrf.TemplateField(ctx)) ctx.View("user/signup.html") - // We could also retrieve the token directly from csrf.Token(r) and + // We could also retrieve the token directly from csrf.Token(ctx) and // set it in the request header - ctx.GetHeader("X-CSRF-Token", token) // This is useful if you're sending JSON to clients or a front-end JavaScript // framework. diff --git a/context/context.go b/context/context.go index 05ea0174..541b1f42 100644 --- a/context/context.go +++ b/context/context.go @@ -1553,8 +1553,7 @@ func (ctx *context) ContentType(cType string) { // if doesn't contain a charset already then append it if !strings.Contains(cType, "charset") { if cType != ContentBinaryHeaderValue { - charset := ctx.Application().ConfigurationReadOnly().GetCharset() - cType += "; charset=" + charset + cType += "; charset=" + ctx.Application().ConfigurationReadOnly().GetCharset() } } @@ -1940,6 +1939,7 @@ func (ctx *context) UploadFormFiles(destDirectory string, before ...func(Context n += n0 } } + return n, nil } }