github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/util/ui/redacted_value.go (about)

     1  package ui
     2  
     3  import "net/http"
     4  
     5  // RedactedValue is the text that is displayed for redacted content. (eg
     6  // authorization tokens, passwords, etc.)
     7  const RedactedValue = "[PRIVATE DATA HIDDEN]"
     8  
     9  func RedactHeaders(header http.Header) http.Header {
    10  	redactedHeaders := make(http.Header)
    11  	for key, value := range header {
    12  		if key == "Authorization" {
    13  			redactedHeaders[key] = []string{RedactedValue}
    14  		} else {
    15  			redactedHeaders[key] = value
    16  		}
    17  	}
    18  	return redactedHeaders
    19  }