http

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2021 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Overview

* Copyright (C) 2020-2021 Arm Limited or its affiliates and Contributors. All rights reserved. * SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IClient

type IClient interface {
	// Get is a convenience helper for doing simple GET requests.
	Get(url string) (*http.Response, error)
	// Head is a convenience method for doing simple HEAD requests.
	Head(url string) (*http.Response, error)
	// Post is a convenience method for doing simple POST requests.
	Post(url, bodyType string, body interface{}) (*http.Response, error)
	// PostForm is a convenience method for doing simple POST operations using
	// pre-filled url.Values form data.
	PostForm(url string, data url.Values) (*http.Response, error)
	// StandardClient returns a stdlib *http.Client with a custom Transport, which
	// shims in a *retryablehttp.Client for added retries.
	StandardClient() *http.Client
	// Perform a PUT request.
	Put(url string, rawBody interface{}) (*http.Response, error)
	// Perform a DELETE request.
	Delete(url string) (*http.Response, error)
	// Perform a generic request with exponential backoff
	Do(req *http.Request) (*http.Response, error)
}

IClient provides a familiar HTTP client interface with automatic retries and exponential backoff.

func NewRetryableClient

func NewRetryableClient() IClient

type RetryableClient

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

func (*RetryableClient) Delete

func (c *RetryableClient) Delete(url string) (*http.Response, error)

func (*RetryableClient) Do

func (c *RetryableClient) Do(req *http.Request) (*http.Response, error)

func (*RetryableClient) Get

func (c *RetryableClient) Get(url string) (*http.Response, error)

func (*RetryableClient) Head

func (c *RetryableClient) Head(url string) (*http.Response, error)

func (*RetryableClient) Post

func (c *RetryableClient) Post(url, bodyType string, body interface{}) (*http.Response, error)

func (*RetryableClient) PostForm

func (c *RetryableClient) PostForm(url string, data url.Values) (*http.Response, error)

func (*RetryableClient) Put

func (c *RetryableClient) Put(url string, rawBody interface{}) (*http.Response, error)

func (*RetryableClient) StandardClient

func (c *RetryableClient) StandardClient() *http.Client

Jump to

Keyboard shortcuts

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