httputil

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package httputil provide useful functions to handle http response.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteResponse

func WriteResponse(c *gin.Context, err error, data interface{})

WriteResponse writes the response data or an error into HTTP reponse.

Types

type ErrResponse

type ErrResponse struct {
	// Code defines the business error code.
	Code int `json:"code"`
	// Message defines the user-safe error message.
	Message string `json:"message"`
}

ErrResponse defines the return messages when an error occurred.

Jump to

Keyboard shortcuts

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