如何对嵌入在结构中的http处理程序进行单元测试?

I have the following struct

type Server struct {
        *http.Server
        chain      core.Blockchainer
        coreServer *network.Server
    }

with its corresponding handler

func (s *Server) methodHandler(w http.ResponseWriter, req *Request, reqParams Params) {
.....
}

How can I unit test my handler?

The handler above

func (s *Server) methodHandler(w http.ResponseWriter, req *Request, reqParams Params) {
.....
}

can be tested by following these steps

handler := http.HandlerFunc(s.methodHandler)

req := httptest.NewRequest(...) 

w := httptest.NewRecorder()

handler(w, req)

resp := w.Result()

assert.Equal(t, expected, resp)