MCPcopy
hub / github.com/caddyserver/caddy / reqEqual

Function reqEqual

modules/caddyhttp/rewrite/rewrite_test.go:496–515  ·  view source on GitHub ↗

reqEqual if r1 and r2 are equal enough for our purposes.

(r1, r2 *http.Request)

Source from the content-addressed store, hash-verified

494
495// reqEqual if r1 and r2 are equal enough for our purposes.
496func reqEqual(r1, r2 *http.Request) bool {
497 if r1.Method != r2.Method {
498 return false
499 }
500 if r1.RequestURI != r2.RequestURI {
501 return false
502 }
503 if (r1.URL == nil && r2.URL != nil) || (r1.URL != nil && r2.URL == nil) {
504 return false
505 }
506 if r1.URL == nil && r2.URL == nil {
507 return true
508 }
509 return r1.URL.Scheme == r2.URL.Scheme &&
510 r1.URL.Host == r2.URL.Host &&
511 r1.URL.Path == r2.URL.Path &&
512 r1.URL.RawPath == r2.URL.RawPath &&
513 r1.URL.RawQuery == r2.URL.RawQuery &&
514 r1.URL.Fragment == r2.URL.Fragment
515}

Callers 1

TestRewriteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected