mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 18:30:56 +00:00
fix #283
This commit is contained in:
parent
2a81595c3e
commit
91c7635d0e
@ -8,6 +8,7 @@ import (
|
|||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"html/template"
|
||||||
"io"
|
"io"
|
||||||
"mime"
|
"mime"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -157,7 +158,7 @@ func (output *BeegoOutput) Jsonp(data interface{}, hasIndent bool) error {
|
|||||||
if callback == "" {
|
if callback == "" {
|
||||||
return errors.New(`"callback" parameter required`)
|
return errors.New(`"callback" parameter required`)
|
||||||
}
|
}
|
||||||
callback_content := bytes.NewBufferString(callback)
|
callback_content := bytes.NewBufferString(template.JSEscapeString(callback))
|
||||||
callback_content.WriteString("(")
|
callback_content.WriteString("(")
|
||||||
callback_content.Write(content)
|
callback_content.Write(content)
|
||||||
callback_content.WriteString(");\r\n")
|
callback_content.WriteString(");\r\n")
|
||||||
|
Loading…
Reference in New Issue
Block a user