Hello, does anybody have a good workaround for the issue of testing gorilla/mux routes that contain variables with httptest? (There's an old discussion about this on the gorilla group, but it seems dead over there.)
Basically, if you test something with a request like the following, the variable (1, in this case) isn't captured:
http.NewRequest("GET", "
http://localhost:3000/employees/1", nil)
At runtime, during normal execution, the variable is captured and a browser/curl request returns a successful response. However while testing, only an empty map is returned, without the "id" variable.
Alternatively, has anybody written a simple api router with similar functionality, perhaps without regexes for improved performance (numerous searches came up empty)? I've been considering doing that, even if it seems like a fool's errand.