response

package
v0.0.0-...-4747e9d Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Send

func Send(statusCode int, err error, result []byte, w http.ResponseWriter)

Send the HTTP response

func SendJSON

func SendJSON(statusCode int, result interface{}, w http.ResponseWriter)

SendJSON the HTTP response

Types

type ErrorResponse

type ErrorResponse struct {
	Status       int    `json:"status,omitempty"`
	ErrorMessage string `json:"error,omitempty"`
}

ErrorResponse defines error if in case any

type Response

type Response struct {
	Status      int
	ContentType string
	Data        []byte
}

Response defines a response sent to client

func (*Response) Write

func (jr *Response) Write(w http.ResponseWriter)

type Writer

type Writer interface {
	Write(w http.ResponseWriter)
}

Writer interface

Jump to

Keyboard shortcuts

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