Documentation ¶
Overview ¶
Package core handles the core functionality of requests apart from any convenience functions and patterns.
Index ¶
- Variables
- type BodyGetter
- type NopCloser
- type RequestBuilder
- func (rb *RequestBuilder) Body(src BodyGetter)
- func (rb *RequestBuilder) Clone() *RequestBuilder
- func (rb *RequestBuilder) Cookie(name, value string)
- func (rb *RequestBuilder) Header(key string, values ...string)
- func (rb *RequestBuilder) Method(method string)
- func (rb *RequestBuilder) Request(ctx context.Context, u *url.URL) (req *http.Request, err error)
- type URLBuilder
- func (ub *URLBuilder) BaseURL(baseurl string)
- func (ub *URLBuilder) Clone() *URLBuilder
- func (ub *URLBuilder) Host(host string)
- func (ub *URLBuilder) Param(key string, values ...string)
- func (ub *URLBuilder) Path(path string)
- func (ub *URLBuilder) Scheme(scheme string)
- func (ub *URLBuilder) URL() (u *url.URL, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var PathCases = map[string]struct { Base string Paths []string Result string }{ "base-only": { "example", []string{}, "https://example", }, "base+abspath": { "https://example", []string{"/a"}, "https://example/a", }, "multi-abs-paths": { "https://example", []string{"/a", "/b/", "/c"}, "https://example/c", }, "base+rel-path": { "https://example/a/", []string{"./b"}, "https://example/a/b", }, "base+rel-paths": { "https://example/a/", []string{"./b/", "./c"}, "https://example/a/b/c", }, "rel-path": { "https://example/", []string{"a/", "./b"}, "https://example/a/b", }, "base+multi-paths": { "https://example/a/", []string{"b/", "c"}, "https://example/a/b/c", }, "base+slash+multi-paths": { "https://example/a/", []string{"b/", "c"}, "https://example/a/b/c", }, "multi-root": { "https://example/", []string{"a", "b", "c"}, "https://example/c", }, "dot-dot-paths": { "https://example/", []string{"a/", "b/", "../c"}, "https://example/a/c", }, "more-dot-dot-paths": { "https://example/", []string{"a/b/c/", "../d/", "../e"}, "https://example/a/b/e", }, "more-dot-dot-paths+rel-path": { "https://example/", []string{"a/b/c/", "../d/", "../e/", "./f"}, "https://example/a/b/e/f", }, "even-more-dot-dot-paths+base": { "https://example/a/b/c/", []string{"../../d"}, "https://example/a/d", }, "too-many-dot-dot-paths": { "https://example", []string{"../a"}, "https://example/a", }, "too-many-dot-dot-paths+base": { "https://example/", []string{"../a"}, "https://example/a", }, "last-abs-path-wins": { "https://example/a/", []string{"b/", "c/", "/d"}, "https://example/d", }, }
PathCases is exported to share tests with requests
Functions ¶
This section is empty.
Types ¶
type BodyGetter ¶
type BodyGetter = func() (io.ReadCloser, error)
type NopCloser ¶
NopCloser is like io.NopCloser(), but it is a concrete type so we can strip it out before setting a body on a request. See https://github.com/carlmjohnson/requests/discussions/49
type RequestBuilder ¶
type RequestBuilder struct {
// contains filtered or unexported fields
}
func (*RequestBuilder) Body ¶
func (rb *RequestBuilder) Body(src BodyGetter)
func (*RequestBuilder) Clone ¶
func (rb *RequestBuilder) Clone() *RequestBuilder
Clone creates a new Builder suitable for independent mutation.
func (*RequestBuilder) Cookie ¶
func (rb *RequestBuilder) Cookie(name, value string)
func (*RequestBuilder) Header ¶
func (rb *RequestBuilder) Header(key string, values ...string)
func (*RequestBuilder) Method ¶
func (rb *RequestBuilder) Method(method string)
type URLBuilder ¶
type URLBuilder struct {
// contains filtered or unexported fields
}
func (*URLBuilder) BaseURL ¶
func (ub *URLBuilder) BaseURL(baseurl string)
func (*URLBuilder) Clone ¶
func (ub *URLBuilder) Clone() *URLBuilder
func (*URLBuilder) Host ¶
func (ub *URLBuilder) Host(host string)
func (*URLBuilder) Param ¶
func (ub *URLBuilder) Param(key string, values ...string)
func (*URLBuilder) Path ¶
func (ub *URLBuilder) Path(path string)
func (*URLBuilder) Scheme ¶
func (ub *URLBuilder) Scheme(scheme string)
Click to show internal directories.
Click to hide internal directories.