reqtango

package module
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2025 License: Apache-2.0 Imports: 14 Imported by: 1

README

reqtango

A simple wrapper around the built-in Golang net/http library

Import

go get github.com/JustBugLord/reqtango

License

Apache License 2.0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Method added in v1.0.3

type Method string
const (
	POST   Method = "POST"
	GET    Method = "GET"
	PUT    Method = "PUT"
	PATCH  Method = "PATCH"
	DELETE Method = "DELETE"
)

type Multipart added in v1.0.2

type Multipart struct {
	ContentType string
	Body        *bytes.Buffer
}

func RawMultipart added in v1.0.3

func RawMultipart(data map[string]io.Reader) (*Multipart, error)

type MultipartBuilder added in v1.0.3

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

func NewMultipartBuilder added in v1.0.3

func NewMultipartBuilder() *MultipartBuilder

func (*MultipartBuilder) AddField added in v1.0.3

func (m *MultipartBuilder) AddField(fieldName, fieldValue string)

func (*MultipartBuilder) AddFileByPath added in v1.0.3

func (m *MultipartBuilder) AddFileByPath(fieldName, filePath string)

func (*MultipartBuilder) Build added in v1.0.3

func (m *MultipartBuilder) Build() (*Multipart, error)

type Record added in v1.0.3

type Record struct {
	RecordType RecordType
	Value      string
}

type RecordType added in v1.0.3

type RecordType string
const (
	File RecordType = "file"
	Text RecordType = "text"
)

type RequestBuilder

type RequestBuilder struct {
	DefaultHeaders map[string]string
	*http.Client
}

func NewRequestBuilder

func NewRequestBuilder(defaultHeaders map[string]string) *RequestBuilder

func NewRequestBuilderSimple added in v0.1.7

func NewRequestBuilderSimple() *RequestBuilder

func (*RequestBuilder) Get

func (b *RequestBuilder) Get(url string, headers ...interface{}) (*Response, error)

func (*RequestBuilder) GetToStruct added in v1.0.0

func (b *RequestBuilder) GetToStruct(url string, to any, headers ...interface{}) ([]byte, error)

func (*RequestBuilder) Post

func (b *RequestBuilder) Post(url, body string, headers ...interface{}) (*Response, error)

func (*RequestBuilder) PostToStruct added in v1.0.0

func (b *RequestBuilder) PostToStruct(url, body string, to any, headers ...interface{}) ([]byte, error)

func (*RequestBuilder) SendRequest

func (b *RequestBuilder) SendRequest(method Method, url string, body io.Reader, headers ...interface{}) (*Response, error)

func (*RequestBuilder) SendRequestRaw added in v1.0.0

func (b *RequestBuilder) SendRequestRaw(method Method, url string, body io.Reader, headers ...interface{}) (*http.Response, []byte, error)

func (*RequestBuilder) SendRequestToStruct added in v1.0.0

func (b *RequestBuilder) SendRequestToStruct(method Method, url string, body io.Reader, to any, headers ...interface{}) ([]byte, error)

func (*RequestBuilder) SetHeaders added in v0.1.8

func (b *RequestBuilder) SetHeaders(headers map[string]string)

func (*RequestBuilder) UploadMultipart added in v1.0.3

func (b *RequestBuilder) UploadMultipart(method Method, url string, data *Multipart, headers ...interface{}) (*Response, error)

func (*RequestBuilder) UploadMultipartToStruct added in v1.0.3

func (b *RequestBuilder) UploadMultipartToStruct(method Method, url string, data *Multipart, to any, headers ...interface{}) ([]byte, error)

type Response

type Response struct {
	Status     string
	StatusCode int
	Body       []byte
}

Jump to

Keyboard shortcuts

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