...

Text file src/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt

Documentation: github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg

     1PACKAGE
     2
     3package goautoneg
     4import "bitbucket.org/ww/goautoneg"
     5
     6HTTP Content-Type Autonegotiation.
     7
     8The functions in this package implement the behaviour specified in
     9http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
    10
    11Copyright (c) 2011, Open Knowledge Foundation Ltd.
    12All rights reserved.
    13
    14Redistribution and use in source and binary forms, with or without
    15modification, are permitted provided that the following conditions are
    16met:
    17
    18    Redistributions of source code must retain the above copyright
    19    notice, this list of conditions and the following disclaimer.
    20
    21    Redistributions in binary form must reproduce the above copyright
    22    notice, this list of conditions and the following disclaimer in
    23    the documentation and/or other materials provided with the
    24    distribution.
    25
    26    Neither the name of the Open Knowledge Foundation Ltd. nor the
    27    names of its contributors may be used to endorse or promote
    28    products derived from this software without specific prior written
    29    permission.
    30
    31THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    32"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    33LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    34A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    35HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    36SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    37LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    38DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    39THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    40(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    41OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    42
    43
    44FUNCTIONS
    45
    46func Negotiate(header string, alternatives []string) (content_type string)
    47Negotiate the most appropriate content_type given the accept header
    48and a list of alternatives.
    49
    50func ParseAccept(header string) (accept []Accept)
    51Parse an Accept Header string returning a sorted list
    52of clauses
    53
    54
    55TYPES
    56
    57type Accept struct {
    58    Type, SubType string
    59    Q             float32
    60    Params        map[string]string
    61}
    62Structure to represent a clause in an HTTP Accept Header
    63
    64
    65SUBDIRECTORIES
    66
    67	.hg

View as plain text