useragent

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2015 License: Apache-2.0 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.

README

This package provides helper functions to pack version information into a single User-Agent header.

Documentation

Overview

Package useragent provides helper functions to pack version information into a single User-Agent header.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilRequest = errors.New("request cannot be nil")
)

Functions

func AppendVersions

func AppendVersions(base string, versions ...VersionInfo) string

Convert versions to a string and append the string to the string base.

Each VersionInfo will be converted to a string in the format of "product/version", where the "product" is get from the name field, while version is get from the version field. Several pieces of verson information will be concatinated and separated by space.

Example: AppendVersions("base", VersionInfo{"foo", "1.0"}, VersionInfo{"bar", "2.0"}) results in "base foo/1.0 bar/2.0".

Types

type VersionInfo

type VersionInfo struct {
	Name    string
	Version string
}

VersionInfo is used to model UserAgent versions.

Jump to

Keyboard shortcuts

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