http

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RequestMethods = map[string]string{
	"GET":     "GET",
	"HEAD":    "HEAD",
	"POST":    "POST",
	"DELETE":  "DELETE",
	"PATCH":   "PATCH",
	"OPTIONS": "OPTIONS",
	"CONNECT": "CONNECT",
	"PUT":     "PUT",
	"TRACE":   "TRACE",
}

RequestMethods holds all acceptable request methods https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods

Functions

This section is empty.

Types

type Request

type Request struct {
	// GoDaddy API Key, note that the prod and dev API's have unique API keys/secrets
	APIKey string
	// GoDaddy API Secret, note that the prod and dev API's have unique API keys/secrets
	APISecret string
	// HTTP REST method we validate this
	Method string
	// The URL you wish to send your request to
	URL string
	// The GoDaddy domain name you wish to target - mostly used internally
	Host string
	// The body of your request, if you need one
	Body []byte
}

Request holds request data

func (*Request) Do

func (r *Request) Do() ([]byte, error)

Do is sends our http request By default, this func does the following:

  • Validates REST method
  • Adds appropriate GoDaddy authorization header
  • Sets `Content-Type` header to `application/json`

Jump to

Keyboard shortcuts

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