code refactor

This commit is contained in:
MaysWind
2023-06-18 16:30:19 +08:00
parent 812bfc7cf5
commit 5f2819a961
8 changed files with 77 additions and 48 deletions
+3 -2
View File
@@ -8,6 +8,7 @@ import (
"strings"
"github.com/mayswind/ezbookkeeping/pkg/core"
"github.com/mayswind/ezbookkeeping/pkg/errs"
"github.com/mayswind/ezbookkeeping/pkg/settings"
)
@@ -25,7 +26,7 @@ var (
)
// AmapApiProxyHandler returns amap api response
func (p *AmapApiProxy) AmapApiProxyHandler(c *core.Context) *httputil.ReverseProxy {
func (p *AmapApiProxy) AmapApiProxyHandler(c *core.Context) (*httputil.ReverseProxy, *errs.Error) {
var targetUrl string
if strings.HasPrefix(c.Request.RequestURI, "/_AMapService/v4/map/styles") {
@@ -56,5 +57,5 @@ func (p *AmapApiProxy) AmapApiProxyHandler(c *core.Context) *httputil.ReversePro
req.Host = targetUrl.Host
}
return &httputil.ReverseProxy{Director: director}
return &httputil.ReverseProxy{Director: director}, nil
}