mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-06-18 18:16:26 +00:00
Add entity filters back in for api
This commit is contained in:
@ -1,6 +1,9 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"npm/internal/logger"
|
||||
"regexp"
|
||||
"strings"
|
||||
"unicode"
|
||||
@ -22,3 +25,16 @@ func CleanupWhitespace(s string) string {
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// PrettyPrintJSON takes a string and as long as it's JSON,
|
||||
// it will return a pretty printed and formatted version
|
||||
func PrettyPrintJSON(s string) string {
|
||||
byt := []byte(s)
|
||||
var prettyJSON bytes.Buffer
|
||||
if err := json.Indent(&prettyJSON, byt, "", " "); err != nil {
|
||||
logger.Debug("Can't pretty print non-json string: %s", s)
|
||||
return s
|
||||
}
|
||||
|
||||
return prettyJSON.String()
|
||||
}
|
||||
|
Reference in New Issue
Block a user