fetch

package
v0.12.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 7 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an HTTP client.

func NewClient

func NewClient(opts ...ClientOption) *Client

NewClient returns new Client

func (*Client) Do

func (c *Client) Do(req *Request) (*http.Response, error)

Do sends an HTTP request and returns an HTTP response

func (*Client) HTTPClient added in v0.12.2

func (c *Client) HTTPClient() *http.Client

HTTPClient returns *http.Client.

type ClientOption added in v0.12.1

type ClientOption func(*Client)

ClientOption is a type that represents an optional function.

func WithBinding added in v0.12.1

func WithBinding(bind js.Value) ClientOption

WithBinding changes the objects that Fetch API belongs to. This is useful for service bindings, mTLS, etc.

type Request

type Request struct {
	*http.Request
}

Request represents an HTTP request and is part of the Fetch API. Docs: https://developers.cloudflare.com/workers/runtime-apis/request/

func NewRequest

func NewRequest(ctx context.Context, method string, url string, body io.Reader) (*Request, error)

NewRequest returns new Request given a method, URL, and optional body

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL