MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / AddDbPathToCookie

Function AddDbPathToCookie

base/util.go:408–420  ·  view source on GitHub ↗

Needed due to https://github.com/couchbase/sync_gateway/issues/1345

(rq *http.Request, cookie *http.Cookie)

Source from the content-addressed store, hash-verified

406
407// Needed due to https://github.com/couchbase/sync_gateway/issues/1345
408func AddDbPathToCookie(rq *http.Request, cookie *http.Cookie) {
409
410 // "/db/foo" -> "db/foo"
411 urlPathWithoutLeadingSlash := strings.TrimPrefix(rq.URL.Path, "/")
412
413 dbPath := "/"
414 pathComponents := strings.Split(urlPathWithoutLeadingSlash, "/")
415 if len(pathComponents) > 0 && pathComponents[0] != "" {
416 dbPath = fmt.Sprintf("/%v", pathComponents[0])
417 }
418 cookie.Path = dbPath
419
420}
421
422// A retry sleeper is called back by the retry loop and passed
423// the current retryCount, and should return the amount of milliseconds

Callers 3

AuthenticateCookieMethod · 0.92
makeStateCookieMethod · 0.92
makeSessionWithTTLMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected