mirror of
https://github.com/silenceper/wechat.git
synced 2026-02-14 09:42:27 +08:00
[feature] Format the code and improve Mini Program authorization to o… (#473)
* [feature] Format the code and improve Mini Program authorization to obtain openid(miniprogram/auth/auth.go Code2Session) * [feature] CheckEncryptedData (https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/user-info/auth.checkEncryptedData.html) * upgrade json error * upgrade json error Co-authored-by: houseme <houseme@outlook.com>
This commit is contained in:
@@ -15,10 +15,10 @@ func writeContextType(w http.ResponseWriter, value []string) {
|
||||
}
|
||||
}
|
||||
|
||||
//Render render from bytes
|
||||
// Render render from bytes
|
||||
func (srv *Server) Render(bytes []byte) {
|
||||
//debug
|
||||
//fmt.Println("response msg = ", string(bytes))
|
||||
// debug
|
||||
// fmt.Println("response msg = ", string(bytes))
|
||||
srv.Writer.WriteHeader(200)
|
||||
_, err := srv.Writer.Write(bytes)
|
||||
if err != nil {
|
||||
@@ -26,13 +26,13 @@ func (srv *Server) Render(bytes []byte) {
|
||||
}
|
||||
}
|
||||
|
||||
//String render from string
|
||||
// String render from string
|
||||
func (srv *Server) String(str string) {
|
||||
writeContextType(srv.Writer, plainContentType)
|
||||
srv.Render([]byte(str))
|
||||
}
|
||||
|
||||
//XML render to xml
|
||||
// XML render to xml
|
||||
func (srv *Server) XML(obj interface{}) {
|
||||
writeContextType(srv.Writer, xmlContentType)
|
||||
bytes, err := xml.Marshal(obj)
|
||||
|
||||
Reference in New Issue
Block a user