Documentation
¶
Index ¶
Constants ¶
View Source
const ( InfoColor = "\033[1;34m%s\033[0m" + endString WarningColor = "\033[1;33m%s\033[0m" + endString )
Log colors
Variables ¶
View Source
var ( // ErrConversion is a converter error ErrConversion = errors.New("webconv: conversion error, possible mailformed payload; check logs") // ErrUnsupported is error type to flag unsupported formats ErrUnsupported = errors.New("webconv: unsupported format") )
Functions ¶
func WebconvHandler ¶
func WebconvHandler(w http.ResponseWriter, r *http.Request)
WebconvHandler a http.handler function
Types ¶
type Config ¶
type Converter ¶
type Converter struct {
Payload bytes.Buffer
ContentType MimeType
Result bytes.Buffer
ResultContentType MimeType
}
Converter holds payload and conversion results
func (*Converter) MakeReply ¶
func (c *Converter) MakeReply(w http.ResponseWriter, err error)
MakeReply returns forms output reply from webserver
func (*Converter) SwapFormat ¶
SwapFormat fill Input.Result if input data is Unsupported they return raw data back (TODO: maybe is better to return 415 Unsupported Media Type?)
type MimeType ¶
type MimeType uint8
MimeType represents Content-Type
func (*MimeType) DetectContentType ¶
DetectContentType detects MIME-Type by reading it from header, if this sections is missing. Then we try to detect it by MIME Sniff algorithm (https://mimesniff.spec.whatwg.org/) this is embedded algorithm in net/http std package
func (*MimeType) FromString ¶
FromString sets MimeType from string It receives a content-type, removes charset part if they presence in ct Ans sets proper value
Click to show internal directories.
Click to hide internal directories.