httphelpers

package
v0.1.1 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: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicAuth

type BasicAuth struct {
	Username string
	Password string
}

type File

type File struct {
	FieldName string
	FilePath  string
}

type HttpClient

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

HttpClient handles HTTP requests and file uploads

func NewHttpClient

func NewHttpClient() *HttpClient

NewHttpClient creates a new HttpClient instance

func (*HttpClient) Do

Do performs an HTTP request.

If the request has a body, it will be sent as a multipart/form-data request. If the request has a file, it will be uploaded as a file. If the request has a form data, it will be added as form fields. If the request has headers, they will be added to the request. If the request has a content type, it will be set as the content type of the request. If the request has a method, it will be set as the method of the request.

type HttpRequestOptions

type HttpRequestOptions struct {
	Endpoint    string
	Method      string
	Headers     map[string]string
	ContentType string
	FormData    map[string]string
	BaseDir     string // BaseDir for file uploads based on feature file location
	File        *File
	RequestBody []byte
	BasicAuth   *BasicAuth
	BearerToken string
}

type HttpResponse

type HttpResponse struct {
	Status     string
	StatusCode int
	Headers    http.Header
	Body       []byte
}

Jump to

Keyboard shortcuts

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