mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 13:30:56 +00:00
Refactoring
This commit is contained in:
parent
6f0a985755
commit
ce6f19871c
@ -146,18 +146,12 @@ func (output *BeegoOutput) Cookie(name string, value string, others ...interface
|
||||
}
|
||||
|
||||
// default false. for session cookie default true
|
||||
httponly := false
|
||||
if len(others) > 4 {
|
||||
if v, ok := others[4].(bool); ok && v {
|
||||
// HttpOnly = true
|
||||
httponly = true
|
||||
fmt.Fprintf(&b, "; HttpOnly")
|
||||
}
|
||||
}
|
||||
|
||||
if httponly {
|
||||
fmt.Fprintf(&b, "; HttpOnly")
|
||||
}
|
||||
|
||||
output.Context.ResponseWriter.Header().Add("Set-Cookie", b.String())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user