server

package
v0.0.0-...-7639478 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbortWithError

func AbortWithError(c *gin.Context, err error)

func AssertBadRequestError

func AssertBadRequestError(t *testing.T, w *httptest.ResponseRecorder)

func AssertDocumentNotFound

func AssertDocumentNotFound(t *testing.T, w *httptest.ResponseRecorder)

func AssertInternalServerError

func AssertInternalServerError(t *testing.T, w *httptest.ResponseRecorder)

func AssertUnauthorized

func AssertUnauthorized(t *testing.T, w *httptest.ResponseRecorder)

Assertion Functions

func ErrorHandler

func ErrorHandler(c *gin.Context)

ErrorHandler a middleware to handle errors

func GinCtx

func GinCtx(c *gin.Context) []interface{}

Obtiene el contexto a serivcios externos En prod este contexto esta vacio.

func GinLoggerMiddleware

func GinLoggerMiddleware(ctx ...interface{}) gin.HandlerFunc

func HeaderToken

func HeaderToken(c *gin.Context) (string, error)

get token from Authorization header

func Router

func Router(ctx ...interface{}) *gin.Engine

func TestDeleteRequest

func TestDeleteRequest(url string, tokenString string) (*http.Request, *httptest.ResponseRecorder)

func TestGetRequest

func TestGetRequest(url string, tokenString string) (*http.Request, *httptest.ResponseRecorder)

func TestPostRequest

func TestPostRequest(url string, body interface{}, tokenString string) (*http.Request, *httptest.ResponseRecorder)

func TestRouter

func TestRouter(ctx ...interface{}) *gin.Engine

Obtiene Router server con el contexto de testing adecuado mockeando interfaces a serivcios externos

func ValidateAuthentication

func ValidateAuthentication(c *gin.Context)

ValidateAuthentication validate gets and check variable body to create new variable puts model.Variable in context as body if everything is correct

Types

type ErrorData

type ErrorData struct {
	Error string `json:"error"`
}

Jump to

Keyboard shortcuts

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