util

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package util implements utility methods

Package util implements utility methods

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteFile

func WriteFile(filename string, content string) error

WriteFile writes the content, passed in as a parameter, to a file, which is also passed in as a parameter. It tries to create the file if it doesn't exist and will return errors when one occurs.

Types

type HTTPResponse

type HTTPResponse struct {
	Body       map[string]interface{}
	StatusCode int
	Headers    http.Header
}

HTTPResponse is the response type for the HTTP requests

func HTTPGet

func HTTPGet(URL string, encoding string, header http.Header) (HTTPResponse, error)

HTTPGet executes a GET request to a URL and returns the response body as a JSON object

func HTTPPatch added in v1.2.0

func HTTPPatch(URL string, encoding string, postData string, header http.Header) (HTTPResponse, error)

HTTPPatch executes a PATCH request to a URL and returns the response body as a JSON object

func HTTPPost

func HTTPPost(URL string, encoding string, postData string, header http.Header) (HTTPResponse, error)

HTTPPost executes a POST request to a URL and returns the response body as a JSON object

Jump to

Keyboard shortcuts

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