From 04d3be6fe09b22fdd1d42f9dfc7bda8e729b73cf Mon Sep 17 00:00:00 2001 From: duanhf2012 Date: Thu, 2 Jan 2020 15:30:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=AD=90=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sysservice/originhttp/httpserverervice.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sysservice/originhttp/httpserverervice.go b/sysservice/originhttp/httpserverervice.go index 0e7b073..0c0bf2f 100644 --- a/sysservice/originhttp/httpserverervice.go +++ b/sysservice/originhttp/httpserverervice.go @@ -6,6 +6,7 @@ import ( "fmt" "io/ioutil" "net/http" + "os" "reflect" "runtime" @@ -34,6 +35,7 @@ type HttpRequest struct { ParamStr string mapParam map[string]string + URL string //Req http.Request } @@ -214,11 +216,11 @@ func (slf *ServeHTTPRouterMux) ServeHTTP(w http.ResponseWriter, r *http.Request) // 拼接得到rpc服务的名称 vstr := strings.Split(url, "/") - if len(vstr) != 3 { + if len(vstr) < 2 { writeRespone(w, http.StatusNotFound, "Cannot find path.") return } - strCallPath = "_" + vstr[1] + ".HTTP_" + vstr[2] + strCallPath = "_" + vstr[0] + ".HTTP_" + vstr[1] } defer r.Body.Close() @@ -228,7 +230,7 @@ func (slf *ServeHTTPRouterMux) ServeHTTP(w http.ResponseWriter, r *http.Request) return } - request := HttpRequest{r.Header, string(msg), r.URL.RawQuery, nil} + request := HttpRequest{r.Header, string(msg), r.URL.RawQuery, nil,r.URL.Path} var resp HttpRespone //resp.Resp = w timeFuncStart := time.Now()