AbsPath overwrites an existing path with the segments provided. Trailing slashes are preserved when a single segment is passed.
(segments ...string)
| 269 | // AbsPath overwrites an existing path with the segments provided. Trailing slashes are preserved |
| 270 | // when a single segment is passed. |
| 271 | func (r *Request) AbsPath(segments ...string) *Request { |
| 272 | if r.err != nil { |
| 273 | return r |
| 274 | } |
| 275 | r.pathPrefix = path.Join(r.baseURL.Path, path.Join(segments...)) |
| 276 | if len(segments) == 1 && (len(r.baseURL.Path) > 1 || len(segments[0]) > 1) && strings.HasSuffix(segments[0], "/") { |
| 277 | // preserve any trailing slashes for legacy behavior |
| 278 | r.pathPrefix += "/" |
| 279 | } |
| 280 | return r |
| 281 | } |
| 282 | |
| 283 | // RequestURI overwrites existing path and parameters with the value of the provided server relative |
| 284 | // URI. |
no outgoing calls