urlbuilder

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 7 Imported by: 10 modules, 9 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

Index

Constants

View Source
const (
	PrefixHeader           = "X-API-URL-Prefix"
	ForwardedAPIHostHeader = "X-API-Host"
	ForwardedHostHeader    = "X-Forwarded-Host"
	ForwardedProtoHeader   = "X-Forwarded-Proto"
	ForwardedPortHeader    = "X-Forwarded-Port"
)

Variables

This section is empty.

Functions

func ConstructBasicURL

func ConstructBasicURL(parts ...string) string

func GetHost

func GetHost(r *http.Request, scheme string) string

func GetScheme

func GetScheme(r *http.Request) string

func New

func New(r *http.Request, resolver PathResolver, schemas *types.APISchemas) (types.URLBuilder, error)

func NewPrefixed

func NewPrefixed(r *http.Request, schemas *types.APISchemas, prefix string) (types.URLBuilder, error)

func ParseRequestURL

func ParseRequestURL(r *http.Request) string

func ParseResponseURLBase

func ParseResponseURLBase(currentURL string, r *http.Request) (string, error)

func RedirectRewrite

func RedirectRewrite(next http.Handler) http.Handler

Types

type DefaultPathResolver

type DefaultPathResolver struct {
	Prefix string
}

func (*DefaultPathResolver) Schema

func (d *DefaultPathResolver) Schema(base string, schema *types.APISchema) string

type DefaultURLBuilder

type DefaultURLBuilder struct {
	// contains filtered or unexported fields
}

func (*DefaultURLBuilder) Action

func (u *DefaultURLBuilder) Action(schema *types.APISchema, id, action string) string

func (*DefaultURLBuilder) Collection

func (u *DefaultURLBuilder) Collection(schema *types.APISchema) string

func (*DefaultURLBuilder) CollectionAction

func (u *DefaultURLBuilder) CollectionAction(schema *types.APISchema, action string) string

func (*DefaultURLBuilder) Current

func (u *DefaultURLBuilder) Current() string
func (u *DefaultURLBuilder) Link(schema *types.APISchema, id string, linkName string) string

func (*DefaultURLBuilder) Marker

func (u *DefaultURLBuilder) Marker(marker string) string

func (*DefaultURLBuilder) RelativeToRoot

func (u *DefaultURLBuilder) RelativeToRoot(path string) string
func (u *DefaultURLBuilder) ResourceLink(schema *types.APISchema, id string) string

type PathResolver

type PathResolver interface {
	Schema(base string, schema *types.APISchema) string
}

Jump to

Keyboard shortcuts

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