http

package
v0.0.0-...-957c8b8 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package http provides a basic http interface that can be used by higher-level abstractions that need to execute http requests but do not care about the underlying host or configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseBody

func CloseBody(rsp *http.Response, err error) error

CloseBody utility function to ensure that a http.Response body is correctly closed

func ValidateResponse

func ValidateResponse(rsp *http.Response, inperr error, entity string, validCodes ...int) (err error)

ValidateResponse utility function to ensure that a returned http response has a valid status code

Types

type HttpClient

type HttpClient interface {
	Head(path string, headers map[string]string) (*http.Response, error)
	Get(path string, headers map[string]string) (*http.Response, error)
	Post(path, payload string, headers map[string]string) (*http.Response, error)
	PostMultipart(path string, parts map[string]string, headers map[string]string) (*http.Response, error)
	Put(path, payload string, headers map[string]string) (*http.Response, error)
	Delete(path string, headers map[string]string) (*http.Response, error)
}

HttpClient interface containing methods for the most common HTTP methods

type HttpError

type HttpError struct {
	Status  int
	Message string
}

HttpError Error() implementation

func (*HttpError) Error

func (e *HttpError) Error() string

Directories

Path Synopsis
Package curl provides a http implementation that utilises curl requests on an existing k8s pod
Package curl provides a http implementation that utilises curl requests on an existing k8s pod

Jump to

Keyboard shortcuts

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