uptrace/bunrouter

How to emulate a webhit

marcelloh opened this issue · 1 comments

💡 The feature or bug you are proposing

Normally I do something like this:

	resp := httptest.NewRecorder()
	req := bunrouter.Request{}
	req.URL = &url.URL{}

and call the controller (handlerfunc) like this:

	controller.GetMoreRecords(resp, req)
	result := resp.Body.String()

then do some asserts on the body
But since req.URL = &url.URL{} doesn't work, I wonder how I can test it now.

Never mind, found out I had to add a small extra:

	resp := httptest.NewRecorder()
	req := bunrouter.Request{}
	req.Request = &http.Request{}
	req.URL = &url.URL{}