utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiResponse

type ApiResponse struct {
	ApiReq *HTTPRequest
	ApiRes *http.Response
	Body   []byte
}

func NewApiResponse

func NewApiResponse(request *HTTPRequest, response *http.Response) *ApiResponse

NewResponse Creates a new Response

func (*ApiResponse) ReadBody

func (r *ApiResponse) ReadBody() ([]byte, error)

ReadBody read the response data, then return it.

func (*ApiResponse) ReadJsonBody

func (r *ApiResponse) ReadJsonBody(v interface{}) error

ReadJsonBody read the response data as JSON into v.

type HTTPRequest

type HTTPRequest struct {
	Debug   bool
	BaseURL string
	Path    string
	Method  string
	Headers map[string]string
	Query   any
	Body    any
}

Jump to

Keyboard shortcuts

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