Fix config tab showing byte string instead of text #479
This commit is contained in:
@@ -110,7 +110,15 @@ func ResponsePrettyJSON(w http.ResponseWriter, v any) {
|
|||||||
|
|
||||||
func Response(w http.ResponseWriter, body any, contentType string) {
|
func Response(w http.ResponseWriter, body any, contentType string) {
|
||||||
w.Header().Set("Content-Type", contentType)
|
w.Header().Set("Content-Type", contentType)
|
||||||
|
|
||||||
|
switch v := body.(type) {
|
||||||
|
case []byte:
|
||||||
|
_, _ = w.Write(v)
|
||||||
|
case string:
|
||||||
|
_, _ = w.Write([]byte(v))
|
||||||
|
default:
|
||||||
_, _ = fmt.Fprint(w, body)
|
_, _ = fmt.Fprint(w, body)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const StreamNotFound = "stream not found"
|
const StreamNotFound = "stream not found"
|
||||||
|
|||||||
Reference in New Issue
Block a user