common

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ContentTypeBinary for binary Content-Type
	ContentTypeBinary = "application/octet-stream"
	// ContentTypeForm for URL encoded form Content-Type
	ContentTypeForm = "application/x-www-form-urlencoded"
	// ContentTypeJSON for JSON Content-Type
	ContentTypeJSON = "application/json; charset=utf-8"
	// ContentTypeHTML for HTML Content-Type
	ContentTypeHTML = "text/html; charset=utf-8"
	// ContentTypeText for text Content-Type
	ContentTypeText = "text/plain; charset=utf-8"
)
View Source
const DefaultTimeout = time.Duration(5 * time.Second)

DefaultTimeout for HTTP requests

View Source
const UserAgent = "Mozilla/5.0 (compatible; Feedpushr/1.0; +https://github.com/ncarlier/feedpushr)"

UserAgent used by HTTP client

Variables

View Source
var (
	// ErrFeedNotFound is returned when a feed is not found in the DB.
	ErrFeedNotFound = errors.New("feed not found")
	// ErrFilterNotFound is returned when a filter is not found in the DB.
	ErrFilterNotFound = errors.New("filter not found")
	// ErrOutputNotFound is returned when a output is not found in the DB.
	ErrOutputNotFound = errors.New("output not found")
)
View Source
var ValidFeedContentType = regexp.MustCompile(`^(application|text)/(\w+\+)?xml`)

ValidFeedContentType is a REGEXP used to validate valid feed Content-Type

Functions

func GetNormalizedBodyFromRequest

func GetNormalizedBodyFromRequest(req *http.Request) (io.Reader, error)

GetNormalizedBodyFromRequest get body reader from HTTP request using UTF-8

func GetNormalizedBodyFromResponse

func GetNormalizedBodyFromResponse(res *http.Response) (io.Reader, error)

GetNormalizedBodyFromResponse get body reader from HTTP response using UTF-8

func Hash

func Hash(values ...string) string

Hash create a hash of a list of values

func IsEmptyString

func IsEmptyString(s *string) bool

IsEmptyString test if a string pointer is nil or empty

Types

This section is empty.

Jump to

Keyboard shortcuts

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