gorequests_retry

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2023 License: LGPL-2.1 Imports: 3 Imported by: 0

README

gorequests-retry

Go codecov

Retry middleware for memclutter/gorequests. Using hashicorp/go-retryablehttp middleware allows you to retry requests when network errors occur or receive specified server status codes.

Install

Installation using the go package system

go get github.com/memclutter/gorequets-retry

Use

To use, pass to the Use() method of the RequestInstance

package main

import (
	"github.com/memclutter/gorequests"
	"github.com/memclutter/gorequests-retry"
	"time"
)

func main() {
	retry := &gorequests_retry.Retry{RetryMax: 5, RetryWaitMin: 200 * time.Millisecond, RetryWaitMax: 700*time.Millisecond}
	err := gorequests.Get("http://example.com").Use(retry).Exec()
	// ...
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Retry

type Retry struct {
	RetryMax     int
	RetryWaitMin time.Duration
	RetryWaitMax time.Duration
}

func (*Retry) ClientOverride

func (m *Retry) ClientOverride(c *http.Client) (*http.Client, error)

Jump to

Keyboard shortcuts

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