ducky/devices
2015-12-19
Parent:c24a6c5fcd8c
ducky/devices/vendor/bitbucket.org/ww/goautoneg/README.txt
Fix JSON pointers in errors when creating devices. Our JSON pointers used to point at the root of the document, but the properties were actually in objects in an array keyed off of "devices", so we had to update the field property of our errors to match. While we were in there, we fixed the "insufficient" error for a Device's name to be "missing" when the name is an empty string. So far, the only way for a Device's name for it to be insufficient is _for it to be the empty string_, but if in the future we raise the minimum length of the Device name, there will be a distinction and I'd like the code to recognise it.
1 PACKAGE
3 package goautoneg
4 import "bitbucket.org/ww/goautoneg"
6 HTTP Content-Type Autonegotiation.
8 The functions in this package implement the behaviour specified in
9 http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
11 Copyright (c) 2011, Open Knowledge Foundation Ltd.
12 All rights reserved.
14 Redistribution and use in source and binary forms, with or without
15 modification, are permitted provided that the following conditions are
16 met:
18 Redistributions of source code must retain the above copyright
19 notice, this list of conditions and the following disclaimer.
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.
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.
31 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
36 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
37 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
38 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
39 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
41 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44 FUNCTIONS
46 func Negotiate(header string, alternatives []string) (content_type string)
47 Negotiate the most appropriate content_type given the accept header
48 and a list of alternatives.
50 func ParseAccept(header string) (accept []Accept)
51 Parse an Accept Header string returning a sorted list
52 of clauses
55 TYPES
57 type Accept struct {
58 Type, SubType string
59 Q float32
60 Params map[string]string
61 }
62 Structure to represent a clause in an HTTP Accept Header
65 SUBDIRECTORIES
67 .hg