messenger.go
func (m *Messenger) Handler(rw http.ResponseWriter, req *http.Request) {
	if req.Method == "GET" {
		query := req.URL.Query()
		if query.Get("hub.verify_token") != m.VerifyToken {
			rw.WriteHeader(http.StatusUnauthorized)
			return
		}
		rw.WriteHeader(http.StatusOK)
		rw.Write([]byte(query.Get("hub.challenge")))
	} else if req.Method == "POST" {
		m.handlePOST(rw, req)
	} else {
		rw.WriteHeader(http.StatusMethodNotAllowed)
	}
}
func (m *Messenger) Handler(rw http.ResponseWriter, req *http.Request) {
	if req.Method == "GET" {
		query := req.URL.Query()
		if query.Get("hub.verify_token") != m.VerifyToken {
			rw.WriteHeader(http.StatusUnauthorized)
			return
		}
		rw.WriteHeader(http.StatusOK)
		rw.Write([]byte(query.Get("hub.challenge")))
	} else if req.Method == "POST" {
		m.handlePOST(rw, req)
	} else {
		rw.WriteHeader(http.StatusMethodNotAllowed)
	}
}
func ( m * Messenger ) Handler ( rw http . ResponseWriter , req * http . Request ) { if req . Method == " " { query := req . URL . Query ( ) if query . Get ( " " ) != m . VerifyToken { rw . WriteHeader ( http . StatusUnauthorized ) return } rw . WriteHeader ( http . StatusOK ) rw . Write ( [ ] byte ( query . Get ( " " ) ) ) } else if req . Method == " " { m . handlePOST ( rw , req ) } else { rw . WriteHeader ( http . StatusMethodNotAllowed ) } }
// Handler is the main HTTP handler for the Messenger service.
// It MUST be attached to some web server in order to receive messages
Handler is the main HTTP handler for the Messenger service . It MUST be attached to some web server in order to receive messages