utils

package
v0.0.0-...-270f78c Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: Zlib Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetArrayObject

func GetArrayObject(jsonObject map[string]interface{}, property string) []interface{}

GetArrayObject will extract an array from a specific property of another JSON object. Returns nil if nothing is associated to the specified key.

func GetJSONObject

func GetJSONObject(jsonObject map[string]interface{}, property string) map[string]interface{}

GetJSONObject will extract an object from a specific property of another JSON object. Returns nil if nothing is associated to the specified key.

func GetRequestAsMap

func GetRequestAsMap(request *http.Request) (map[string]interface{}, error)

GetRequestAsMap returns the response content as a generic JSON object

func GetResponseAsJSONArray

func GetResponseAsJSONArray(response *http.Response) ([]interface{}, error)

GetResponseAsJSONArray returns the response content as an array of generic JSON object

func GetResponseAsJSONObject

func GetResponseAsJSONObject(response *http.Response) (map[string]interface{}, error)

GetResponseAsJSONObject returns the response content as a generic JSON object

func RewriteAccessDeniedResponse

func RewriteAccessDeniedResponse(response *http.Response) error

RewriteAccessDeniedResponse will overwrite the existing response with an access denied response

func RewriteRequest

func RewriteRequest(request *http.Request, newData interface{}) error

RewriteRequest will replace the existing request body with the one specified in parameters

func RewriteResponse

func RewriteResponse(response *http.Response, newResponseData interface{}, statusCode int) error

RewriteResponse will replace the existing response body and status code with the one specified in parameters

func WriteAccessDeniedResponse

func WriteAccessDeniedResponse() (*http.Response, error)

WriteAccessDeniedResponse will create a new access denied response

Types

This section is empty.

Jump to

Keyboard shortcuts

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