github.com/wallyworld/juju@v0.0.0-20161013125918-6cf1bc9d917a/resource/api/mime_pre-go16.go (about)

     1  // Copyright 2016 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  //+build !go1.6
     5  
     6  package api
     7  
     8  // TODO(natefinch) remove this once we support building on go 1.6 for all platforms.
     9  import "github.com/juju/juju/resource/api/internal/mime"
    10  
    11  // formatMediaType serializes mediatype t and the parameters
    12  // param as a media type conforming to RFC 2045 and RFC 2616.
    13  // The type and parameter names are written in lower-case.
    14  // When any of the arguments result in a standard violation then
    15  // formatMediaType returns the empty string.
    16  func formatMediaType(t string, param map[string]string) string {
    17  	return mime.FormatMediaType(t, param)
    18  }
    19  
    20  // parseMediaType parses a media type value and any optional
    21  // parameters, per RFC 1521.  Media types are the values in
    22  // Content-Type and Content-Disposition headers (RFC 2183).
    23  // On success, parseMediaType returns the media type converted
    24  // to lowercase and trimmed of white space and a non-nil map.
    25  // The returned map, params, maps from the lowercase
    26  // attribute to the attribute value with its case preserved.
    27  func parseMediaType(v string) (mediatype string, params map[string]string, err error) {
    28  	return mime.ParseMediaType(v)
    29  }
    30  
    31  func getEncoder() encoder {
    32  	return mime.BEncoding
    33  }
    34  
    35  func getDecoder() decoder {
    36  	return &mime.WordDecoder{}
    37  }