Private
Public Access
1
0

web/server: stub /pollUpdates

This commit is contained in:
2023-06-22 23:55:46 -07:00
parent 732e9b9667
commit 191cffd4cf

View File

@@ -6,8 +6,8 @@ import (
"net/http" "net/http"
"strings" "strings"
"github.com/rs/zerolog/log"
"code.severnaya.net/kordophone-mock/v2/server" "code.severnaya.net/kordophone-mock/v2/server"
"github.com/rs/zerolog/log"
) )
type MockHTTPServerConfiguration struct { type MockHTTPServerConfiguration struct {
@@ -156,6 +156,11 @@ func (m *MockHTTPServer) handleNotFound(w http.ResponseWriter, r *http.Request)
http.NotFound(w, r) http.NotFound(w, r)
} }
func (m *MockHTTPServer) handlePollUpdates(w http.ResponseWriter, r *http.Request) {
// Stub: return 205 (Nothing to report)
w.WriteHeader(http.StatusResetContent)
}
func (m *MockHTTPServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { func (m *MockHTTPServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
m.logRequest(r, r.URL.Query().Encode()) m.logRequest(r, r.URL.Query().Encode())
m.mux.ServeHTTP(w, r) m.mux.ServeHTTP(w, r)
@@ -173,6 +178,8 @@ func NewMockHTTPServer(config MockHTTPServerConfiguration) *MockHTTPServer {
this.mux.Handle("/status", http.HandlerFunc(this.handleStatus)) this.mux.Handle("/status", http.HandlerFunc(this.handleStatus))
this.mux.Handle("/authenticate", http.HandlerFunc(this.handleAuthenticate)) this.mux.Handle("/authenticate", http.HandlerFunc(this.handleAuthenticate))
this.mux.Handle("/messages", http.HandlerFunc(this.handleMessages)) this.mux.Handle("/messages", http.HandlerFunc(this.handleMessages))
this.mux.Handle("/pollUpdates", http.HandlerFunc(this.handlePollUpdates))
this.mux.Handle("/", http.HandlerFunc(this.handleNotFound)) this.mux.Handle("/", http.HandlerFunc(this.handleNotFound))
return &this return &this