goautoneg

package module
v0.0.0-...-c6008fe Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2019 License: Apache-2.0 Imports: 4 Imported by: 6

README

goautoneg

Go Report Card CircleCI

This is a complete rewrite of https://bitbucket.org/ww/goautoneg and aims to be a drop-in replacement of that module. The aforementioned repository seems unmaintained with the last commit having been done on 2012-07.07.

The Negotiate function is not implemented currently because a quick search resulted in the ParseAccept function being used in the majority of cases.

Ultimately, we should end up with this implementation being internalized in Go's standard library. The proposal for that has already been accepted and it's a matter of time for it to land. This is mostly a stop-gap until that happens.

Why do this?

That's a very fair question!

  1. The original version on bitbucket.org is hosted as a Mercurial repository. Nothing's wrong with that but dep has it's issues with that if hg (the Mercurial client) is not installed locally. Several high-profile repositories (like Kubernetes' API server) depend on it though, which makes it a pain to constantly point out to new contributors to install hg, as it seems so unnecessary. This is especially true if the dependency is pulled in transitively, so you might even be aware of the fact that you now have a Mercurial dependency in your project. An inquiry to mirror the Mercurial repository to a git repository remains unanswered.
  2. The original repository has no LICENSE file. The license is part of README.txt though so an automated license checker can be made happy with some sed magic. It ain't pretty though.
  3. Bugs go unanswered.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accept

type Accept struct {
	Type, SubType string
	Q             float64
	Params        map[string]string
}

Accept is a structure to represent a clause in an HTTP Accept Header.

func ParseAccept

func ParseAccept(header string) []Accept

ParseAccept parses the given string as an Accept header as defined in https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1. Some rules are only loosely applied and might not be as strict as defined in the RFC.

Jump to

Keyboard shortcuts

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