http

package
v0.0.0-...-d72b88c Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicGet

func BasicGet(url string) (int, string, error)

BasicGet is a simple wrapper over HTTP client

func Get

func Get(params GetParams) (int, string, error)

Get performs GET request according to passed parameters

func IntoJSON

func IntoJSON(target interface{}) func(string, error) error

IntoJSON builds and returns lambda, that will decode from JSON results, obtained from functions like Only200

func Only200

func Only200(code int, body string, err error) (string, error)

Only200 takes result from HTTP get and returns error it HTTP status code not 200 If there were error already, it returns existing one

func ReadFile

func ReadFile(url string) ([]byte, error)

ReadFile returns contents of the file for specified url

Types

type GetParams

type GetParams struct {
	URL     string
	Headers map[string]string
}

GetParams contains all the parameters for get request

Jump to

Keyboard shortcuts

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