http

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package http implements cancellable REST requests with custom User-Agent.

Index

Constants

View Source
const (
	StatusOK = 200
)

Selected HTTP status codes as registered with IANA. See: https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	AppVersion string
	// contains filtered or unexported fields
}

A Client is an HTTP client.

func (*Client) Get

func (c *Client) Get(ctx context.Context, url string) (resp *http.Response, err error)

Get issues a GET to the specified URL with given context and custom User-Agent. It is a replacement for net/http module Get function.

func (*Client) UserAgent

func (c *Client) UserAgent() string

UserAgent constructs User-Agent string in format: `opinions/<version_number> (<os>; +https://github.com/macie/opinions)`.

Jump to

Keyboard shortcuts

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