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
a9881388
Commit
a9881388
authored
Nov 12, 2015
by
JessonChan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
accept encoder header setting fixed
parent
1200b7c3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
5 deletions
+4
-5
acceptencoder.go
context/acceptencoder.go
+0
-2
output.go
context/output.go
+4
-3
No files found.
context/acceptencoder.go
View file @
a9881388
...
...
@@ -23,7 +23,6 @@ import (
"strconv"
"strings"
"fmt"
"io/ioutil"
)
...
...
@@ -50,7 +49,6 @@ func writeLevel(encoding string, writer io.Writer, content []byte, level int) (b
var
outputWriter
io
.
Writer
var
err
error
if
cf
,
ok
:=
encoderMap
[
encoding
];
ok
{
fmt
.
Println
(
"write level"
,
encoding
)
outputWriter
,
err
=
cf
.
encode
(
writer
,
level
)
}
else
{
encoding
=
""
...
...
context/output.go
View file @
a9881388
...
...
@@ -52,23 +52,24 @@ func (output *BeegoOutput) Header(key, val string) {
// if EnableGzip, compress content string.
// it sends out response body directly.
func
(
output
*
BeegoOutput
)
Body
(
content
[]
byte
)
{
outputWriter
:=
output
.
Context
.
ResponseWriter
.
(
io
.
Writer
)
var
encoding
string
var
buf
=
&
bytes
.
Buffer
{}
if
output
.
EnableGzip
{
encoding
=
ParseEncoding
(
output
.
Context
.
Input
.
Request
)
}
if
b
,
n
,
_
:=
WriteBody
(
encoding
,
outputWriter
,
content
);
b
{
if
b
,
n
,
_
:=
WriteBody
(
encoding
,
buf
,
content
);
b
{
output
.
Header
(
"Content-Encoding"
,
n
)
}
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
}
io
.
Copy
(
output
.
Context
.
ResponseWriter
,
buf
)
}
// Cookie sets cookie value via given key.
...
...
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