|
|
@@ -96,8 +96,8 @@ func wrapServiceHandler(handler ServiceHandler) gin.HandlerFunc {
|
|
|
r.Header.Set(XServicePath, servicePath)
|
|
|
}
|
|
|
|
|
|
- servicePath := r.Header.Get(XServicePath)
|
|
|
- messageID := r.Header.Get(XMessageID)
|
|
|
+ servicePath := getRpcxHeader(r, XServicePath)
|
|
|
+ messageID := getRpcxHeader(r, XMessageID)
|
|
|
wh := w.Header()
|
|
|
if messageID != "" {
|
|
|
wh.Set(XMessageID, messageID)
|
|
|
@@ -111,7 +111,7 @@ func wrapServiceHandler(handler ServiceHandler) gin.HandlerFunc {
|
|
|
xmeta = "tenant=" + tenant
|
|
|
}
|
|
|
|
|
|
- serviceMethod := r.Header.Get(XServiceMethod)
|
|
|
+ serviceMethod := getRpcxHeader(r, XServiceMethod)
|
|
|
if serviceMethod != "" {
|
|
|
if xmeta != "" {
|
|
|
xmeta = xmeta + "&"
|
|
|
@@ -210,6 +210,19 @@ func wrapServiceHandler(handler ServiceHandler) gin.HandlerFunc {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func getRpcxHeader(r *http.Request, key string) string {
|
|
|
+ val := r.Header.Get(key)
|
|
|
+ if val != "" {
|
|
|
+ return val
|
|
|
+ } else {
|
|
|
+ if values, ok := r.URL.Query()[key]; ok && len(values) > 0 {
|
|
|
+ return values[0]
|
|
|
+ } else {
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func (s *Server) Serve() error {
|
|
|
return s.g.Run(s.addr)
|
|
|
}
|