mirror of
https://github.com/mpolden/echoip.git
synced 2025-06-25 20:27:50 +02:00
Rename Handlers -> Router
This commit is contained in:
@ -234,7 +234,7 @@ func (fn appHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
func (a *API) Handlers() http.Handler {
|
||||
func (a *API) Router() http.Handler {
|
||||
r := mux.NewRouter()
|
||||
|
||||
// JSON
|
||||
@ -258,8 +258,3 @@ func (a *API) Handlers() http.Handler {
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
func (a *API) ListenAndServe(addr string) error {
|
||||
http.Handle("/", a.Handlers())
|
||||
return http.ListenAndServe(addr, nil)
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ func httpGet(url string, json bool, userAgent string) (string, int, error) {
|
||||
|
||||
func TestCLIHandlers(t *testing.T) {
|
||||
log.SetOutput(ioutil.Discard)
|
||||
s := httptest.NewServer(newTestAPI().Handlers())
|
||||
s := httptest.NewServer(newTestAPI().Router())
|
||||
|
||||
var tests = []struct {
|
||||
url string
|
||||
@ -79,7 +79,7 @@ func TestCLIHandlers(t *testing.T) {
|
||||
|
||||
func TestJSONHandlers(t *testing.T) {
|
||||
log.SetOutput(ioutil.Discard)
|
||||
s := httptest.NewServer(newTestAPI().Handlers())
|
||||
s := httptest.NewServer(newTestAPI().Router())
|
||||
|
||||
var tests = []struct {
|
||||
url string
|
||||
|
Reference in New Issue
Block a user