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 assetsFS embed.FS
var ( var (
assetsPath = "/echarts/statics/" assetsPath = "/admin/plow/echarts/statics/"
apiPath = "/data/" apiPath = "/admin/plow/data/"
latencyView = "latency" latencyView = "latency"
rpsView = "rps" rpsView = "rps"
timeFormat = "15:04:05" timeFormat = "15:04:05"
@ -64,7 +64,7 @@ function {{ .ViewID }}_sync() {
<html> <html>
{{- template "header" . }} {{- template "header" . }}
<body> <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> <style> .box { justify-content:center; display:flex; flex-wrap:wrap } </style>
<div class="box"> {{- range .Charts }} {{ template "base" . }} {{- end }} </div> <div class="box"> {{- range .Charts }} {{ template "base" . }} {{- end }} </div>
</body> </body>
@ -202,6 +202,7 @@ func (c *Charts) Handler(ctx *fasthttp.RequestCtx) {
ctx.Error(err.Error(), 404) ctx.Error(err.Error(), 404)
} else { } else {
ctx.SetBodyStream(f, -1) ctx.SetBodyStream(f, -1)
ctx.SetContentType("application/x-javascript")
} }
} else { } else {
ctx.Error("NotFound", fasthttp.StatusNotFound) ctx.Error("NotFound", fasthttp.StatusNotFound)

View File

@ -5,6 +5,7 @@ import (
"net" "net"
"net/http" "net/http"
_ "net/http/pprof" _ "net/http/pprof"
URI "net/url"
"os" "os"
"strconv" "strconv"
"strings" "strings"
@ -256,7 +257,12 @@ func main() {
// description // description
var desc string var desc string
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) desc = fmt.Sprintf("Benchmarking %s", *url)
}
if *requests > 0 { if *requests > 0 {
desc += fmt.Sprintf(" with %d request(s)", *requests) desc += fmt.Sprintf(" with %d request(s)", *requests)
} }