MCPcopy Index your code
hub / github.com/VictoriaMetrics/VictoriaLogs / GetRequestURI

Function GetRequestURI

lib/httpserver/httpserver.go:730–762  ·  view source on GitHub ↗

GetRequestURI returns requestURI for r.

(r *http.Request)

Source from the content-addressed store, hash-verified

728
729// GetRequestURI returns requestURI for r.
730func GetRequestURI(r *http.Request) string {
731 requestURI := r.RequestURI
732 if r.Method != http.MethodPost {
733 return requestURI
734 }
735 _ = r.ParseForm()
736 if len(r.PostForm) == 0 {
737 return requestURI
738 }
739 // code copied from url.Query.Encode
740 var queryArgs strings.Builder
741 for k := range r.PostForm {
742 vs := r.PostForm[k]
743 // mask authKey as well-known secret
744 if k == "authKey" {
745 vs = []string{"secret"}
746 }
747 keyEscaped := url.QueryEscape(k)
748 for _, v := range vs {
749 if queryArgs.Len() > 0 {
750 queryArgs.WriteByte('&')
751 }
752 queryArgs.WriteString(keyEscaped)
753 queryArgs.WriteByte('=')
754 queryArgs.WriteString(url.QueryEscape(v))
755 }
756 }
757 delimiter := "?"
758 if strings.Contains(requestURI, delimiter) {
759 delimiter = "&"
760 }
761 return requestURI + delimiter + queryArgs.String()
762}
763
764// Redirect redirects to the given url.
765func Redirect(w http.ResponseWriter, url string) {

Callers 9

RequestHandlerFunction · 0.92
QueryHandlerFunction · 0.92
queryRangeHandlerFunction · 0.92
GetCommonParamsFunction · 0.92
tryProcessingRequestFunction · 0.92
incRequestConcurrencyFunction · 0.92
SendPrometheusErrorFunction · 0.85
ErrorfFunction · 0.85
LogErrorFunction · 0.85

Calls 3

ContainsMethod · 0.80
StringMethod · 0.65
LenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…