client

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Description: This file contains the client package which is responsible for creating a new HTTP client with custom transport settings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendRequest

func SendRequest(url string, requestHeaders map[string]string, httpClient *http.Client) error

SendRequest sends a request but does not read or return the response.

Types

type Config

type Config struct {
	DialTimeout           time.Duration // Timeout for establishing the connection
	HandshakeTimeout      time.Duration // Timeout for TLS handshake
	ResponseHeaderTimeout time.Duration // Timeout for server response headers
	ProxyURL              string        // Proxy URL for the HTTP client (optional)
}

Config holds configuration settings for the HTTP client.

func (Config) CreateNewClient

func (c Config) CreateNewClient() *http.Client

New creates a new HTTP client with custom transport settings.

type Response

type Response struct {
	StatusCode int                 `json:"StatusCode"`
	Headers    map[string][]string `json:"Headers"`
	Body       string              `json:"Body"`
	Location   string              `json:"Location"`
}

Response holds the response from the URL

func FetchResponse

func FetchResponse(url string, requestHeaders map[string]string, httpClient *http.Client) (*Response, error)

FetchResponse sends a GET request and returns the response.

Jump to

Keyboard shortcuts

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