http

package
v0.13.0-test.4 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: Apache-2.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FetchCallStack = testutils.NewCallStack()

Functions

This section is empty.

Types

type Content

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

func NewContent

func NewContent(value any) *Content

func (*Content) JSON

func (c *Content) JSON(result any)

func (*Content) Text

func (c *Content) Text() string
type Header struct {
	Name   string
	Values []string
}

type Headers

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

func NewHeaders

func NewHeaders[T [][]string | map[string]string | map[string][]string](value T) *Headers

func (*Headers) Append

func (h *Headers) Append(name, value string)

func (*Headers) Entries

func (h *Headers) Entries() [][]string

func (*Headers) Get

func (h *Headers) Get(name string) *string

type Request

type Request struct {
	Url     string
	Method  string
	Headers *Headers
	Body    []byte
}

func NewRequest

func NewRequest(url string, options ...*RequestOptions) *Request

func (*Request) Clone

func (r *Request) Clone(options ...*RequestOptions) *Request

func (*Request) JSON

func (r *Request) JSON(result any)

func (*Request) Text

func (r *Request) Text() string

type RequestOptions

type RequestOptions struct {
	Method  string
	Headers any
	Body    any
}

type Response

type Response struct {
	Status     uint16
	StatusText string
	Headers    *Headers
	Body       []byte
}

func Fetch

func Fetch[T *Request | string](requestOrUrl T, options ...*RequestOptions) (*Response, error)

func (*Response) JSON

func (r *Response) JSON(result any)

func (*Response) Ok

func (r *Response) Ok() bool

func (*Response) Text

func (r *Response) Text() string

Jump to

Keyboard shortcuts

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