helpers

package
v0.0.0-...-f65bb3f Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONModelToBytesJSON

func JSONModelToBytesJSON(model interface{}) (*bytes.Reader, error)

JSONModelToBytesJSON - preforms model -> bytes.Reader(implements io.Reader). useful for passing payload to http request in tests

Example: ``` fakeUpdEmailReq := helpers.GetUpdateEmailRequestModel() payload, _ := helpers.JSONModelToBytesJSON(fakeUpdEmailReq) ctx.Request, _ = http.NewRequest(

"POST",
"/api/v1/credentials-api/update_email",
payload,

) ```

func NewTestHTTPRequest

func NewTestHTTPRequest(method, url string, postBody interface{}) *http.Request

NewTestHTTPRequest is a HTTP request builder for testing purposes

func ServeTestRequest

func ServeTestRequest(
	req *http.Request,
	resp http.ResponseWriter,
	r *gin.Engine,
	ctrl apiv1.Controller,
)

ServeTestRequest creates HTTP handler for controller

Types

This section is empty.

Jump to

Keyboard shortcuts

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