Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Router = routeHandler{}
Functions ¶
func Fetch ¶
Fetches any URL using the fetch() Web API. Unlike browsers, CloudFlare workers miss some features like credentials.
If you don't need headers or a request body, set them to nil:
Fetch(myUrl, "GET", nil, nil)
To create a POST/PUT body, use cfgo.BodyForm() or cfgo.BodyString():
Fetch(myURL, "PUT", nil, cfgo.BodyForm(myDict))
Types ¶
type FetchBody ¶
func BodyString ¶
type KVNamespace ¶
type KVNamespace struct {
Name string
}
func KV ¶
func KV(namespace string) KVNamespace
func (KVNamespace) GetKey ¶
func (namespace KVNamespace) GetKey(key string) string
func (KVNamespace) ListKeyValues ¶
func (namespace KVNamespace) ListKeyValues(prefix string) map[string]string
func (KVNamespace) PutKey ¶
func (namespace KVNamespace) PutKey(key string, value string)
func (KVNamespace) PutKeyExpiring ¶
func (namespace KVNamespace) PutKeyExpiring(key string, value string, seconds int)
type Request ¶
type Request struct { Body string Headers map[string]string QueryParams map[string]string URL string Hostname string Pathname string Method string Cf RequestCFInfo // contains filtered or unexported fields }
func (*Request) Respond ¶
func (r *Request) Respond(body string, options ...ResponseOption)
type RequestCFInfo ¶
type RequestCFInfo struct { Asn string Colo string Country string HttpProtocol string RequestPriority string TLSCipher string TLSClientAuth string TLSVersion string City string Continent string Latitude string Longitude string PostalCode string MetroCode string Region string RegionCode string Timezone string }
type ResponseOption ¶
type ResponseOption interface {
Apply(responseStruct *responseStruct)
}
func SetHeader ¶
func SetHeader(key string, value string) ResponseOption
func SetStatus ¶
func SetStatus(code int) ResponseOption
Click to show internal directories.
Click to hide internal directories.