fix error for proxy

This commit is contained in:
rulingcom 2023-04-22 00:10:45 +08:00
parent 036a6dfe8f
commit 02808390ca
2 changed files with 11 additions and 4 deletions

View File

@ -28,8 +28,8 @@ import (
var assetsFS embed.FS
var (
assetsPath = "/echarts/statics/"
apiPath = "/data/"
assetsPath = "/admin/plow/echarts/statics/"
apiPath = "/admin/plow/data/"
latencyView = "latency"
rpsView = "rps"
timeFormat = "15:04:05"
@ -64,7 +64,7 @@ function {{ .ViewID }}_sync() {
<html>
{{- template "header" . }}
<body>
<p align="center">🚀 <a href="https://github.com/six-ddc/plow"><b>Plow</b></a> %s</p>
<p align="center">🚀 <a target="_blank" href="https://github.com/six-ddc/plow"><b>Plow</b></a> %s</p>
<style> .box { justify-content:center; display:flex; flex-wrap:wrap } </style>
<div class="box"> {{- range .Charts }} {{ template "base" . }} {{- end }} </div>
</body>
@ -202,6 +202,7 @@ func (c *Charts) Handler(ctx *fasthttp.RequestCtx) {
ctx.Error(err.Error(), 404)
} else {
ctx.SetBodyStream(f, -1)
ctx.SetContentType("application/x-javascript")
}
} else {
ctx.Error("NotFound", fasthttp.StatusNotFound)

View File

@ -5,6 +5,7 @@ import (
"net"
"net/http"
_ "net/http/pprof"
URI "net/url"
"os"
"strconv"
"strings"
@ -256,7 +257,12 @@ func main() {
// description
var desc string
desc = fmt.Sprintf("Benchmarking %s", *url)
if *host != "" {
uri, _ := URI.Parse(*url)
desc = fmt.Sprintf("Benchmarking %s://%s%s", uri.Scheme, *host, uri.RequestURI())
}else{
desc = fmt.Sprintf("Benchmarking %s", *url)
}
if *requests > 0 {
desc += fmt.Sprintf(" with %d request(s)", *requests)
}