serverurl

package
v0.16.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package serverurl reads OpenAPI server URLs, which may be templates that url.Parse rejects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasePath

func BasePath(serverURL string) string

BasePath returns the path of an OpenAPI server URL, as url.Parse reports it.

A server variable in the scheme, host, or port (for example "https://{host}/api/v1") makes url.Parse fail, so the path is then read from after the host instead.

func TrimBasePath added in v0.16.3

func TrimBasePath(path, base string) (string, bool)

TrimBasePath removes base from the start of path when base ends on a segment boundary, so a base of "/api" matches "/api" and "/api/pets" but not "/apistatus". It reports whether base matched.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL