Merge pull request #27060 from yongtang/27021-inspect-show-env

Disable HTML escaping for JSON strings in `docker inspect`
Upstream-commit: 420e22fad4dcdff3b8025666216cc85fc9358f69
Component: engine
This commit is contained in:
Vincent Demeester
2016-10-02 14:32:56 +02:00
committed by GitHub
2 changed files with 13 additions and 1 deletions

View File

@ -81,7 +81,9 @@ func ParseForm(r *http.Request) error {
func WriteJSON(w http.ResponseWriter, code int, v interface{}) error {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(code)
return json.NewEncoder(w).Encode(v)
enc := json.NewEncoder(w)
enc.SetEscapeHTML(false)
return enc.Encode(v)
}
// VersionFromContext returns an API version from the context using APIVersionKey.