Replace fmt.Sprintf with direct combining strings

This commit is contained in:
mstmdev 2022-03-25 22:03:07 +08:00
parent cb2e89b1ca
commit 9be676c638
1 changed files with 1 additions and 3 deletions

View File

@ -129,9 +129,7 @@ func (r JsonpJSON) Render(w http.ResponseWriter) (err error) {
_, err = w.Write(ret) _, err = w.Write(ret)
return err return err
} }
_, err = w.Write(bytesconv.StringToBytes(template.JSEscapeString(r.Callback) + "(" + bytesconv.BytesToString(ret) + ");"))
jsonpData := fmt.Sprintf("%s(%s);", template.JSEscapeString(r.Callback), bytesconv.BytesToString(ret))
_, err = w.Write(bytesconv.StringToBytes(jsonpData))
return err return err
} }