Sfoglia il codice sorgente

envelop body is used for debug purpose only.

master
sp 4 anni fa
parent
commit
612421221d
1 ha cambiato i file con 6 aggiunte e 3 eliminazioni
  1. +6
    -3
      apiV1Response.go

+ 6
- 3
apiV1Response.go Vedi File

package main package main


import ( import (
"biukop/sfm/loan"
"biukop.com/sfm/loan"
"encoding/json" "encoding/json"
"fmt" "fmt"
"net/http" "net/http"
Success bool Success bool
Msg string Msg string
TimeStamp string TimeStamp string
Body interface{}
Body map[string]interface{}
Session loan.Session Session loan.Session
} }


Msg: "", Msg: "",
TimeStamp: ts, TimeStamp: ts,
} }
ret.Body = make(map[string]interface{})
return return
} }


func (m *apiV1Response) sendJson(w http.ResponseWriter) (ret []byte, e error) { func (m *apiV1Response) sendJson(w http.ResponseWriter) (ret []byte, e error) {
tempMap := m.tmp tempMap := m.tmp
m.tmp = nil m.tmp = nil
tempMap["_"] = m.Env
if config.Debug {
tempMap["_"] = m.Env
}
ret, e = json.Marshal(tempMap) ret, e = json.Marshal(tempMap)
//sent //sent
w.Header().Set("Content-Type", "text/json; charset=utf-8") w.Header().Set("Content-Type", "text/json; charset=utf-8")

Loading…
Annulla
Salva