This is an automated email from the ASF dual-hosted git repository.

zhangjintao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git


The following commit(s) were added to refs/heads/master by this push:
     new e6dbaa7a fix: malformed URL created in schemaClient (#1772)
e6dbaa7a is described below

commit e6dbaa7acb6624d9a7ebca723784380badbeb092
Author: Ashish Tiwari <[email protected]>
AuthorDate: Mon Apr 10 13:47:44 2023 +0530

    fix: malformed URL created in schemaClient (#1772)
---
 pkg/apisix/schema.go      | 2 +-
 pkg/apisix/schema_test.go | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkg/apisix/schema.go b/pkg/apisix/schema.go
index 65451137..28a7eb29 100644
--- a/pkg/apisix/schema.go
+++ b/pkg/apisix/schema.go
@@ -33,7 +33,7 @@ type schemaClient struct {
 
 func newSchemaClient(c *cluster) Schema {
        return &schemaClient{
-               url:     c.baseURL + "/schema/",
+               url:     c.baseURL + "/schema",
                cluster: c,
        }
 }
diff --git a/pkg/apisix/schema_test.go b/pkg/apisix/schema_test.go
index 67fe4445..5601d09e 100644
--- a/pkg/apisix/schema_test.go
+++ b/pkg/apisix/schema_test.go
@@ -54,7 +54,7 @@ func (srv *fakeAPISIXSchemaSrv) ServeHTTP(w 
http.ResponseWriter, r *http.Request
        }
 
        if r.Method == http.MethodGet {
-               name := strings.Trim(strings.TrimPrefix(r.URL.Path, 
"/apisix/admin/schema/"), "/")
+               name := strings.TrimPrefix(r.URL.Path, "/apisix/admin/schema/")
                if len(name) < 1 {
                        w.WriteHeader(http.StatusBadRequest)
                        return

Reply via email to