Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Extractor ¶
var URL Extractor = func(key string, req *muxer.Request) (interface{}, error) { value, ok := req.QueryString[key] if !ok { return nil, nil } url, err := url.Parse(value) if err != nil { return nil, fmt.Errorf("URL %s is not valid", value) } mimetype := mime.TypeByExtension(filepath.Ext(value)) _, ok = image.Extensions[mimetype] if !ok { return nil, fmt.Errorf("Mimetype %s is not supported", mimetype) } return url, nil }
Click to show internal directories.
Click to hide internal directories.