Back to

Package httputil

Latest Go to latest

The latest major version is v2.

Published: Mar 4, 2020 | License: LGPL-3.0 | Module:


Package httputil holds utility functions related to net/http.


func RelativeURLPath

func RelativeURLPath(basePath, targPath string) (string, error)

RelativeURLPath returns a relative URL path that is lexically equivalent to targpath when interpreted by url.URL.ResolveReference. On success, the returned path will always be non-empty and relative to basePath, even if basePath and targPath share no elements.

It is assumed that both basePath and targPath are normalized (have no . or .. elements).

An error is returned if basePath or targPath are not absolute paths.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier