Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
384fa8fd
authored
2013-06-13 18:50:26 -0700
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge pull request #70 from luw2007/luw2007
fix jsonp, use Buffer
2 parents
ea756b68
5d531d3d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
controller.go
controller.go
View file @
384fa8f
...
...
@@ -227,10 +227,13 @@ func (c *Controller) ServeJsonp() {
http
.
Error
(
c
.
Ctx
.
ResponseWriter
,
`"callback" parameter required`
,
http
.
StatusInternalServerError
)
return
}
callback_content
:=
fmt
.
Sprintf
(
"%s(%s);
\r\n
"
,
callback
,
string
(
content
))
c
.
Ctx
.
SetHeader
(
"Content-Length"
,
strconv
.
Itoa
(
len
(
callback_content
)),
true
)
c
.
Ctx
.
ResponseWriter
.
Header
()
.
Set
(
"Content-Type"
,
"application/jsonp;charset=UTF-8"
)
c
.
Ctx
.
ResponseWriter
.
Write
([]
byte
(
callback_content
))
callback_content
:=
bytes
.
NewBufferString
(
callback
)
callback_content
.
WriteString
(
"("
)
callback_content
.
Write
(
content
)
callback_content
.
WriteString
(
");
\r\n
"
)
c
.
Ctx
.
SetHeader
(
"Content-Length"
,
strconv
.
Itoa
(
callback_content
.
Len
()),
true
)
c
.
Ctx
.
ResponseWriter
.
Header
()
.
Set
(
"Content-Type"
,
"application/json;charset=UTF-8"
)
c
.
Ctx
.
ResponseWriter
.
Write
(
callback_content
.
Bytes
())
}
func
(
c
*
Controller
)
ServeXml
()
{
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment