httpclient

package
v0.0.0-...-110f058 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const TimeoutRequest = 60 * time.Second

Variables

This section is empty.

Functions

func ConvertHeadersToHttp

func ConvertHeadersToHttp(headers []Header) http.Header

func ConvertQueriesToUrl

func ConvertQueriesToUrl(queries []Query, url url.Values) url.Values

func SendRequest

func SendRequest(client HttpClient, req *Request) (*http.Response, error)

func SendRequestWithContext

func SendRequestWithContext(ctx context.Context, client HttpClient, req *Request) (*http.Response, error)

Types

type Header struct {
	HeaderKey string
	Value     string
}

func ConvertHttpHeaderToHeaders

func ConvertHttpHeaderToHeaders(headers http.Header) []Header

type HttpClient

type HttpClient interface {
	Do(req *http.Request) (*http.Response, error)
}

func New

func New() HttpClient

type Query

type Query struct {
	QueryKey string
	Value    string
}

type Request

type Request struct {
	Method  string
	URL     string
	Queries []Query
	Headers []Header
	Body    []byte
}

type Response

type Response struct {
	StatusCode int      `json:"statusCode"`
	Body       []byte   `json:"body"`
	Headers    []Header `json:"headers"`
}

func SendRequestAndConvert

func SendRequestAndConvert(client HttpClient, req *Request, exampleID idwrap.IDWrap) (Response, error)

func SendRequestAndConvertWithContext

func SendRequestAndConvertWithContext(ctx context.Context, client HttpClient, req *Request, exampleID idwrap.IDWrap) (Response, error)

type ResponseVar

type ResponseVar struct {
	StatusCode int               `json:"status"`
	Body       any               `json:"body"`
	Headers    map[string]string `json:"headers"`
	Duration   int32             `json:"duration"`
}

func ConvertResponseToVar

func ConvertResponseToVar(r Response) ResponseVar

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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