utils

package
v0.0.0-...-931ad58 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsuccessfulRequest = errors.New("unsuccessful request")

Functions

func CheckResponseStatus

func CheckResponseStatus(res *http.Response) error

func IsNotModified

func IsNotModified(res *http.Response) bool

Types

type XMLReader

type XMLReader struct {
	ReplacementChar rune
	// contains filtered or unexported fields
}

XMLReader implements a Reader that reads XML responses and does two things: 1. Ignores non UTF-8 characters. 2. If ReplacementChar is not rune(0), non-XML valid runes are replaced with that.

func NewXMLReader

func NewXMLReader(rd io.Reader, replaceNonXMLChars bool) XMLReader

NewXMLReader wraps a new XMLReader around an existing reader. replaceNonXMLChars is a convenience option that sets ReplacementChar to the unicode white square character. This character will replace all invalid XML characters found in the stream.

func (XMLReader) Read

func (reader XMLReader) Read(b []byte) (int, error)

Reads bytes into the byte array b whilst ignoring non utf-8 characters Returns the number of bytes read and an error if one occurs.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL