Skip to content

Requesting Flashes is always seen as modification #276

Open
@camille-sound4

Description

If you use Flashes to get the flash messages at each request (to process templates for instance), the session is always modified, even if there was no flash.
This adds unnecessary cookie updates.

To avoid this, s.written should be set to true only if the Flashes array len is > 0.

func (s *session) Flashes(vars ...string) []interface{} {
	flashes := s.Session().Flashes(vars...)
	s.written = len(flashes) > 0
	return flashes
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions