Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
3bb4d6f0
Commit
3bb4d6f0
authored
Jul 08, 2014
by
Christoph Portmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
beego/context: Fix ignored Header in case SetStatus has been called before
parent
fefd8ddb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
output.go
context/output.go
+8
-1
router.go
router.go
+5
-0
No files found.
context/output.go
View file @
3bb4d6f0
...
...
@@ -71,6 +71,14 @@ func (output *BeegoOutput) Body(content []byte) {
}
else
{
output
.
Header
(
"Content-Length"
,
strconv
.
Itoa
(
len
(
content
)))
}
// Write status code if it has been set manually
// Set it to 0 afterwards to prevent "multiple response.WriteHeader calls"
if
output
.
Status
!=
0
{
output
.
Context
.
ResponseWriter
.
WriteHeader
(
output
.
Status
)
output
.
Status
=
0
}
output_writer
.
Write
(
content
)
switch
output_writer
.
(
type
)
{
case
*
gzip
.
Writer
:
...
...
@@ -270,7 +278,6 @@ func (output *BeegoOutput) ContentType(ext string) {
// SetStatus sets response status code.
// It writes response header directly.
func
(
output
*
BeegoOutput
)
SetStatus
(
status
int
)
{
output
.
Context
.
ResponseWriter
.
WriteHeader
(
status
)
output
.
Status
=
status
}
...
...
router.go
View file @
3bb4d6f0
...
...
@@ -762,6 +762,11 @@ Admin:
Info
(
"beego:"
+
r
.
URL
.
Path
+
" 404"
+
" +"
+
timeend
.
String
())
}
}
// Call WriteHeader if status code has been set changed
if
context
.
Output
.
Status
!=
0
{
w
.
writer
.
WriteHeader
(
context
.
Output
.
Status
)
}
}
func
(
p
*
ControllerRegistor
)
recoverPanic
(
rw
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment