Re: [go-nuts] Can't figure out why simple mockserver doesn't hit the handler

2025-03-15 Thread David Karr
Ok, I figured out the basic problem. I had neglected to configure the server url in the httpclient object used by both the CUT and the test, so the request wasn't being sent to the mock server or the mock handler. Thanks for the responses. Some of that will be useful anyway. I didn't realize th

Re: [go-nuts] Can't figure out why simple mockserver doesn't hit the handler

2025-03-14 Thread Lin Lin
Hi, David, I'm no expert on http std. But the following testcase based on the httptest unittest code works. I think the key point is to use ' client.Get(server.URL)' to invoke a request. Hope it helps. import "testing" import "os" import "net/http" import "net/http/httptest" func TestProcessProj

[go-nuts] Can't figure out why simple mockserver doesn't hit the handler

2025-03-14 Thread David Karr
A little while ago, I was able to write some unit tests for some code that makes an http connection. I created a mockserver and a client using that server. That test in that application works fine. I'm now trying to do basically the same thing in a different application. I'm trying to start wi