package falcore

import (
	"fmt"
	"io/ioutil"
	"net/http"
	"testing"
)

func TestHandlerFilter(t *testing.T) {
	reply := "Hello, World"
	handler := func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprintf(w, reply)
	}

	hff := NewHandlerFilter(http.HandlerFunc(handler))

	tmp, _ := http.NewRequest("GET", "/hello", nil)
	_, res := TestWithRequest(tmp, hff, nil)

	if res == nil {
		t.Errorf("Response is nil")
	}

	if replyGot, err := ioutil.ReadAll(res.Body); err != nil {
		t.Errorf("Error reading body: %v", err)
	} else if string(replyGot) != reply {
		t.Errorf("Expected body does not match")
	}

}

package falcore

import (
	"fmt"
	"io/ioutil"
	"net/http"
	"testing"
)

func TestHandlerFilter(t *testing.T) {
	reply := "Hello, World"
	handler := func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprintf(w, reply)
	}

	hff := NewHandlerFilter(http.HandlerFunc(handler))

	tmp, _ := http.NewRequest("GET", "/hello", nil)
	_, res := TestWithRequest(tmp, hff)

	if res == nil {
		t.Errorf("Response is nil")
	}

	if replyGot, err := ioutil.ReadAll(res.Body); err != nil {
		t.Errorf("Error reading body: %v", err)
	} else if string(replyGot) != reply {
		t.Errorf("Expected body does not match")
	}

}

--- 
+++ 
@@ -16,7 +16,7 @@
 	hff := NewHandlerFilter(http.HandlerFunc(handler))
 
 	tmp, _ := http.NewRequest("GET", "/hello", nil)
-	_, res := TestWithRequest(tmp, hff)
+	_, res := TestWithRequest(tmp, hff, nil)
 
 	if res == nil {
 		t.Errorf("Response is nil")
Fix handler test with new TestWithRequest signature