http

package
v0.0.0-...-9fb9eb8 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderErrorResponse

func RenderErrorResponse(r *http.Request, w http.ResponseWriter, err error)

func RenderResponse

func RenderResponse(w http.ResponseWriter, successResponse interface{}, statusCode int)

Types

type ErrorDetail

type ErrorDetail struct {
	Code         string `json:"code"`
	Message      string `json:"message"`
	MessageTitle string `json:"message_title"`
}

type ServiceResponse

type ServiceResponse struct {
	Success bool          `json:"success"`
	Data    interface{}   `json:"data,omitempty"`
	Error   []ErrorDetail `json:"errors,omitempty"`
}

func NewBadRequestError

func NewBadRequestError(message string) ServiceResponse

func NewInternalServerError

func NewInternalServerError() ServiceResponse

func NewNotFoundError

func NewNotFoundError() ServiceResponse

func NewSuccessServiceResponse

func NewSuccessServiceResponse(data interface{}) *ServiceResponse

func NewUnauthorizedError

func NewUnauthorizedError(message string) ServiceResponse

func NewUnprocessableEntityError

func NewUnprocessableEntityError(message string) ServiceResponse

Jump to

Keyboard shortcuts

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