api

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeResBody

func DecodeResBody(res *http.Response) map[string]interface{}

DecodeResBody reads and decodes the JSON body of an HTTP response into a map.

func GetResErrorCode

func GetResErrorCode(resBody map[string]interface{}) errorUtil.ErrorCode

GetResErrorCode extracts an error code from the response body.

func MockHTTPRequest

func MockHTTPRequest(method string, path string, body interface{}, queryParams ...QueryParam) *http.Request

MockHTTPRequest creates a mock HTTP request with the specified method, path, body, and optional query parameters. It supports both string and JSON bodies.

Types

type QueryParam

type QueryParam struct {
	Key   string
	Value string
}

Jump to

Keyboard shortcuts

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