Comments (5)
Line 314 in 3374b69
// Set Cookies
ctx.writeCookies()
if re.redirect { // handle redirects
ctx.Log().Debugf("Redirecting to '%s' with status '%d'", re.path, re.Code)
http.Redirect(ctx.Res, ctx.Req.Unwrap(), re.path, re.Code)
return
}
// Check ContentType and detect it if need be
if len(re.ContType) == 0 {
if _, ok := re.Rdr.(*binaryRender); !ok {
re.ContentType(ctx.detectContentType())
}
}
if len(re.ContType) > 0 {
ctx.Res.Header().Set(ahttp.HeaderContentType, re.ContType)
}
// 'OnHeaderReply' HTTP event
e.publishOnHeaderReplyEvent(ctx.Res.Header())
if bodyAllowedForStatus(re.Code) {
if e.a.viewMgr != nil && re.isHTML() {
e.a.viewMgr.resolve(ctx)
}
e.writeOnWire(ctx)
Apparently the session is saved before template is actually rendered. That's why the flash message is retained.
from aah.
Managed to mitigate this issue using a PostReply subscriber:
aah.App().HTTPEngine().OnPostReply(func(e *aah.Event) {
ctx, ok := e.Data.(*aah.Context)
if !ok {
return
}
if err := aah.App().SessionManager().SaveSession(ctx.Res, ctx.Session()); err != nil {
ctx.Log().Errorf("error saving session: %v", err)
return
}
ctx.Log().Println("session successfully saved")
})
from aah.
@vcraescu Thanks for reporting an issue. I will have a look and address the issue.
from aah.
thanks!
from aah.
@jeevatkm any news?
from aah.
Related Issues (20)
- Add precedence to de-facto headers X-Forwarded-Host, X-Forwarded-Port HOT 1
- Methods are not discovered and not registered from controller struct properly HOT 3
- Audit wiki Permissions HOT 2
- Override config not working for a single aah binary HOT 1
- Docs issue in "Getting started". HOT 4
- Error running aah cli 'build' on certain projects after upgrading go1.11 to 1.12 HOT 3
- Add pluggable component for health check feature HOT 3
- Expose an aah TestServer for aah users to thoroughly test aah applications
- Routes behavior with&without a root (/) route is inconsistent HOT 2
- Route param 'redirect_trailing_slash' can create redirect loop HOT 2
- Possibility to return a 5XX response code from the authc&authz phases. HOT 2
- invalid memory address or nil pointer dereference when registering centralized error handler HOT 2
- Notification to aah users :) HOT 2
- Vulnerability HOT 4
- Regarding DDoS code section
- Support Go Mod HOT 1
- FATAL: go build: -i flag is deprecated / undefined: models HOT 2
- Address compile issue and make it work :) HOT 1
- Inactive? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aah.