Documentation
¶
Overview ¶
Package httpclient is Readeck's own HTTP client. It provides an http.RoundTripper with sensible defaults that can make outgoing requests look like they come from a browser.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddToCache ¶
AddToCache adds a URL, headers and body to an http.Client cache. If the client's transport is not a CacheTransport instance, it does nothing.
func IsInCache ¶
IsInCache returns true if a URL exists in an http.Client cache. If the client's transport is not a CacheTransport instance, it does nothing.
func NewCacheClient ¶
NewCacheClient returns a new http.Client with a CacheTransport round tripper. The "check" function, when not null, can be used to exclude a request from any cache request.
Types ¶
type CacheTransport ¶
CacheTransport is a wrapper around Transport that adds a cache layer.
func (*CacheTransport) RoundTrip ¶
RoundTrip implements http.RoundTripper. When an entry is found in the cache, it sends a response made out of it. Otherwise, it calls the wrapped RoundTrip method.
type Transport ¶
type Transport struct {
http.RoundTripper
// contains filtered or unexported fields
}
Transport wraps an http.RoundTripper.
func (*Transport) RoundTrip ¶
RoundTrip implements http.RoundTripper. It checks if the destination IP is allowed, adds default headers and logs (debug-10 level) every request.