utils

package
v0.0.0-...-a1fd3b9 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2015 License: MIT Imports: 5 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Request2IP

func Request2IP(request *HTTPRequest) ([][]byte, error)

Request2IP converts a given request to IP

func Response2IP

func Response2IP(response *HTTPResponse) ([][]byte, error)

Response2IP сonverts a given response to IP

Types

type HTTPClientOptions

type HTTPClientOptions struct {
	URL         string              `json:"url"`
	Method      string              `json:"method"`
	ContentType string              `json:"content-type"`
	Headers     map[string][]string `json:"headers"`
	Form        url.Values          `json:"form"`
}

HTTPClientOptions describe options IP for client configuration

type HTTPRequest

type HTTPRequest struct {
	ID     string              `json:"id"`      // Assigned by server component
	Method string              `json:"method"`  // GET/POST/PUT/etc
	URI    string              `json:"uri"`     // Full URL that hit the server
	Header map[string][]string `json:"headers"` // Map of headers
	Form   map[string][]string `json:"form"`    // Map of GET/POST/PUT values
}

HTTPRequest data structure for IP

func IP2Request

func IP2Request(ip [][]byte) (*HTTPRequest, error)

IP2Request сonverts a given IP to request structure

func Request2Request

func Request2Request(request *http.Request) *HTTPRequest

Request2Request create our internal request structure based on the standard one

type HTTPResponse

type HTTPResponse struct {
	ID         string              `json:"id"`      // Retrieved from request structure
	StatusCode int                 `json:"status"`  // Response HTTP status code
	Header     map[string][]string `json:"headers"` // Map of headers
	Body       []byte              `json:"body"`    // Body of the response
}

HTTPResponse data structure for IP

func IP2Response

func IP2Response(ip [][]byte) (*HTTPResponse, error)

IP2Response сonverts a given IP to response structure

func Response2Response

func Response2Response(response *http.Response) (*HTTPResponse, error)

Response2Response create our internal response structure based on the standard one

Jump to

Keyboard shortcuts

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