diff options
| author | Shulhan <ms@kilabit.info> | 2024-03-08 01:42:11 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2024-03-09 01:10:24 +0700 |
| commit | 8007793b86bac3ca0bf937fe246deae5ac46a503 (patch) | |
| tree | f9297531956f219223b56b5d6730690af64a428c /lib/http/server_test.go | |
| parent | 6653805a0949eafc4a478749842d61b12ef5916a (diff) | |
| download | pakakeh.go-8007793b86bac3ca0bf937fe246deae5ac46a503.tar.xz | |
lib/http: refactor of RegisterEndpoint and RegisterSSE to non-pointer
Once the endpoint registered, the caller should not able to changes
any values on endpoint again.
Diffstat (limited to 'lib/http/server_test.go')
| -rw-r--r-- | lib/http/server_test.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/http/server_test.go b/lib/http/server_test.go index eee0144c..f18b27c6 100644 --- a/lib/http/server_test.go +++ b/lib/http/server_test.go @@ -49,7 +49,7 @@ func TestRegisterDelete(t *testing.T) { ResponseType: ResponseTypePlain, Call: cbPlain, }, - expError: ErrEndpointAmbiguous.Error(), + expError: `RegisterEndpoint: ` + ErrEndpointAmbiguous.Error(), }, { desc: "With unknown path", reqURL: testServerURL, @@ -133,15 +133,16 @@ func TestRegisterDelete(t *testing.T) { expBody: "map[id:[1]]\nmap[]\n<nil>\n", }} + var err error for _, c := range cases { t.Log(c.desc) - var err = testServer.RegisterEndpoint(c.ep) - if err != nil { - if !errors.Is(ErrEndpointAmbiguous, err) { - test.Assert(t, "error", c.expError, err.Error()) + if c.ep != nil { + err = testServer.RegisterEndpoint(*c.ep) + if err != nil { + test.Assert(t, `error`, c.expError, err.Error()) + continue } - continue } if len(c.reqURL) == 0 { |
