示例#1
0
func loginIfNeeded() {
	if session.ReadSessionID() == "" {
		term.Section()
		term.Println("Please log in:")
		login()
	}
}
示例#2
0
func addHeaders(req *http.Request) {
	sessionID := session.ReadSessionID()
	appKey := config.Read().AppKey

	if sessionID != "" {
		req.Header.Add("x-appstax-sessionid", sessionID)
	}
	if appKey != "" {
		req.Header.Add("x-appstax-appkey", appKey)
	}
}