Documentation ¶
Overview ¶
Package http contains the basic HTTP functionality of the application
Index ¶
- type ProxySettings
- type Session
- func (s *Session) CheckDownloadedFileForErrors(writtenSize int64, responseHeader http.Header) (err error)
- func (s *Session) EnsureDownloadDirectory(fileName string)
- func (s *Session) GetDocument(response *http.Response) *goquery.Document
- func (s *Session) UpdateTreeFolderChangeTimes(filePath string)
- type SessionInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProxySettings ¶
type ProxySettings struct { Enable bool `mapstructure:"enable"` Host string `mapstructure:"host"` Port int `mapstructure:"port"` Username string `mapstructure:"username"` Password string `mapstructure:"password"` }
ProxySettings are the proxy server settings for the session
type Session ¶
type Session struct { SessionInterface ModuleKey string }
Session is an implementation to the SessionInterface to provide basic functions
func (*Session) CheckDownloadedFileForErrors ¶
func (s *Session) CheckDownloadedFileForErrors(writtenSize int64, responseHeader http.Header) (err error)
CheckDownloadedFileForErrors compares the downloaded file with the content length header of the request if set also checks if the written bytes are more not equal or less than 0 which is definitely an unwanted result
func (*Session) EnsureDownloadDirectory ¶
EnsureDownloadDirectory ensures that the download path already exists or creates it if not this function panics when path can't be created
func (*Session) GetDocument ¶
GetDocument converts the http response to a *goquery.Document
func (*Session) UpdateTreeFolderChangeTimes ¶
UpdateTreeFolderChangeTimes recursively updates the folder access and modification times to indicate changes in the data for file explorers
type SessionInterface ¶
type SessionInterface interface { Get(uri string) (response *http.Response, err error) Post(uri string, data url.Values) (response *http.Response, err error) DownloadFile(filepath string, uri string) (err error) EnsureDownloadDirectory(fileName string) CheckDownloadedFileForErrors(writtenSize int64, responseHeader http.Header) (err error) GetDocument(response *http.Response) *goquery.Document GetClient() *http.Client UpdateTreeFolderChangeTimes(filePath string) SetProxy(proxySettings *ProxySettings) (err error) SetClient(client *http.Client) }
SessionInterface of used functions from the application to eventually change the underlying library