Exemplo n.º 1
0
func negotiateOutputStreamSerializer(req *http.Request, ns runtime.NegotiatedSerializer) (runtime.StreamSerializerInfo, error) {
	supported := ns.SupportedMediaTypes()
	mediaType, params, err := negotiateOutput(req, supported)
	if err != nil {
		return runtime.StreamSerializerInfo{}, err
	}
	if s, ok := ns.StreamingSerializerForMediaType(mediaType, params); ok {
		return s, nil
	}
	return runtime.StreamSerializerInfo{}, errNotAcceptable{supported}
}
Exemplo n.º 2
0
func negotiateOutputStreamSerializer(req *http.Request, ns runtime.NegotiatedSerializer) (runtime.Serializer, runtime.Framer, string, string, error) {
	supported := ns.SupportedMediaTypes()
	mediaType, params, err := negotiateOutput(req, supported)
	if err != nil {
		return nil, nil, "", "", err
	}
	if s, f, exactMediaType, ok := ns.StreamingSerializerForMediaType(mediaType, params); ok {
		return s, f, mediaType, exactMediaType, nil
	}
	return nil, nil, "", "", errNotAcceptable{supported}
}