uritemplates

package
v0.234.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2025 License: BSD-3-Clause, BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package uritemplates is a level 3 implementation of RFC 6570 (URI Template, http://tools.ietf.org/html/rfc6570). uritemplates does not support composite values (in Go: slices or maps) and so does not qualify as a level 4 implementation.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Expand

func Expand(path string, values map[string]string) (escaped, unescaped string, err error)

Expand parses then expands a URI template with a set of values to produce the resultant URI. Two forms of the result are returned: one with all the elements escaped, and one with the elements unescaped.

Example
values := map[string]string{
	"user": "golang",
	"repo": "go",
}
expanded, _, err := Expand("https://api.github.com/repos{/user,repo}", values)
if err != nil {
	log.Fatalf("Error expanding template: %v", err)
}
fmt.Println(expanded)
Output:

https://api.github.com/repos/golang/go

Types

This section is empty.

Jump to

Keyboard shortcuts

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

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy