Example #1
0
// RecognizesData implements the RecognizingDecoder interface.
func (s *Serializer) RecognizesData(peek io.Reader) (bool, error) {
	_, ok := utilyaml.GuessJSONStream(peek, 2048)
	if s.yaml {
		return !ok, nil
	}
	return ok, nil
}
Example #2
0
// RecognizesData implements the RecognizingDecoder interface.
func (s *Serializer) RecognizesData(peek io.Reader) (ok, unknown bool, err error) {
	if s.yaml {
		// we could potentially look for '---'
		return false, true, nil
	}
	_, ok = utilyaml.GuessJSONStream(peek, 2048)
	return ok, false, nil
}