http_client

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2025 License: GPL-3.0 Imports: 3 Imported by: 0

README

internal/http_client

Responsibility

  • Provides a wrapper around the standard net/http client.
  • Handles HTTP requests and responses with custom configuration.
  • Implements retry logic and error handling.

Scope

  • HTTP client creation and configuration.
  • Request execution and response handling.
  • Retry logic for failed requests.

Test Suite Overview

  • Tests should cover request execution, response handling, and retry logic.

Decisions & Potential Gotchas

  • Uses the standard net/http client.
  • Retry logic is configurable.
  • Error handling should be robust.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultHTTPClient

type DefaultHTTPClient struct{}

DefaultHTTPClient is the default implementation of HTTPClient.

func (*DefaultHTTPClient) Post

func (c *DefaultHTTPClient) Post(url, contentType string, body *bytes.Buffer) (*http.Response, error)

Post makes an HTTP POST request.

type HTTPClient

type HTTPClient interface {
	Post(url, contentType string, body *bytes.Buffer) (*http.Response, error)
}

HTTPClient is an interface for making HTTP requests.

func NewHTTPClient

func NewHTTPClient() HTTPClient

NewHTTPClient creates a new HTTPClient.

type MockHTTPClient

type MockHTTPClient struct {
	mock.Mock
}

MockHTTPClient is a mock implementation of HTTPClient.

func (*MockHTTPClient) Post

func (m *MockHTTPClient) Post(url, contentType string, body *bytes.Buffer) (*http.Response, error)

Post makes an HTTP POST request.

Jump to

Keyboard shortcuts

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