diff --git a/kenall.go b/kenall.go index 999159e..ac2dc6d 100644 --- a/kenall.go +++ b/kenall.go @@ -149,7 +149,7 @@ func (cli *Client) GetAddress(ctx context.Context, postalCode string) (*GetAddre return nil, ErrInvalidArgument } - const path = "/postalCode/" + const path = "/postalcode/" req, err := http.NewRequestWithContext(ctx, http.MethodGet, cli.Endpoint+path+postalCode, nil) if err != nil { diff --git a/kenall_test.go b/kenall_test.go index 3b3888a..fcc2bce 100644 --- a/kenall_test.go +++ b/kenall_test.go @@ -282,7 +282,7 @@ func runTestingServer(t *testing.T) *httptest.Server { } switch path := r.URL.Path; { - case strings.HasPrefix(path, "/postalCode/"): + case strings.HasPrefix(path, "/postalcode/"): handlePostalAPI(t, w, path) case strings.HasPrefix(path, "/cities/"): handleCityAPI(t, w, path) @@ -296,21 +296,21 @@ func handlePostalAPI(t *testing.T, w http.ResponseWriter, path string) { t.Helper() switch path { - case "/postalCode/1008105": + case "/postalcode/1008105": if _, err := w.Write(addressResponse); err != nil { w.WriteHeader(http.StatusInternalServerError) } - case "/postalCode/4020000": + case "/postalcode/4020000": w.WriteHeader(http.StatusPaymentRequired) - case "/postalCode/4030000": + case "/postalcode/4030000": w.WriteHeader(http.StatusForbidden) - case "/postalCode/4050000": + case "/postalcode/4050000": w.WriteHeader(http.StatusMethodNotAllowed) - case "/postalCode/5000000": + case "/postalcode/5000000": w.WriteHeader(http.StatusInternalServerError) - case "/postalCode/5030000": + case "/postalcode/5030000": w.WriteHeader(http.StatusServiceUnavailable) - case "/postalCode/0000001": + case "/postalcode/0000001": if _, err := w.Write([]byte("wrong")); err != nil { w.WriteHeader(http.StatusInternalServerError) }