Needed due to https://github.com/couchbase/sync_gateway/issues/1345
(rq *http.Request, cookie *http.Cookie)
| 406 | |
| 407 | // Needed due to https://github.com/couchbase/sync_gateway/issues/1345 |
| 408 | func 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 |
no outgoing calls
no test coverage detected