http

package
v1.15.3 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentTypeJSON           = "application/json"
	ContentTypeFormURLEncoded = "application/x-www-form-urlencoded"
)

Variables

This section is empty.

Functions

func NewBody

func NewBody(bodyType ...BodyType) http.Body

NewBody creates a new BodyImpl instance with an optional bodyType argument. If bodyType is not provided, it defaults to BodyTypeJSON.

Types

type BodyImpl

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

func (*BodyImpl) Build

func (r *BodyImpl) Build() (http.Reader, error)

func (*BodyImpl) GetField

func (r *BodyImpl) GetField(key string) any

func (*BodyImpl) SetField

func (r *BodyImpl) SetField(key string, value any) http.Body

func (*BodyImpl) SetFields

func (r *BodyImpl) SetFields(fields map[string]any) http.Body

func (*BodyImpl) SetFile

func (r *BodyImpl) SetFile(fieldName, filePath string) http.Body

func (*BodyImpl) SetFiles

func (r *BodyImpl) SetFiles(files map[string]string) http.Body

type BodyType

type BodyType int
const (
	BodyTypeJSON BodyType = iota
	BodyTypeForm
	BodyTypeMultipart
)

Jump to

Keyboard shortcuts

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