Documentation
¶
Overview ¶
Package web is the one way celestial-data reaches an archive: a GET, a HEAD and a POST. A client keeps the cookies its answers set, so a session signed in goes with what it asks. Everything goes through Web, so a test can hold an adapter to the exact addresses it asks for.
Index ¶
- func Seconds(count float64) time.Duration
- type Client
- func (client Client) Cookies(address string) ([]*http.Cookie, error)
- func (client Client) Get(url string) (io.ReadCloser, int64, error)
- func (client Client) Head(url string) (int64, error)
- func (client Client) Keep(address string, cookies []*http.Cookie) error
- func (client Client) Post(address string, form url.Values) (string, error)
- type Web
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is Web over HTTP. Its zero value is not ready; New makes one.
func New ¶
New makes a Client. The server gets wait to connect and to begin its answer. The whole request gets whole, up to its last byte. Zero is no limit. That suits a large file on a slow link.
func (Client) Cookies ¶
Cookies are the cookies the client holds for an address: those its answers set, and those Keep gave it.
func (Client) Get ¶
Get is Web's Get over HTTP. Any answer but a success is an error that names the URL and the status. Its body is closed.
type Web ¶
type Web interface {
// Get opens what a URL holds. length is the number of bytes the
// server said it would send, or -1 when it did not say.
Get(url string) (body io.ReadCloser, length int64, err error)
// Head is the length of what a URL holds, as its server tells it.
// It is -1 when the server does not say.
Head(url string) (length int64, err error)
// Post sends a form to an address and gives the address its answer
// sends on to, or none. It does not go on to it.
Post(address string, form url.Values) (where string, err error)
}
Web is what an adapter asks of the network.