response

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package response providers support for returning http responses

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorCodeToStatusCode

func ErrorCodeToStatusCode(code te.CodeType) int

ErrorCodeToStatusCode maps a tharsis error code string to a http status code integer.

Types

type Writer

type Writer interface {
	RespondWithError(w http.ResponseWriter, err error)
	RespondWithJSON(w http.ResponseWriter, model interface{}, statusCode int)
	RespondWithJSONAPI(w http.ResponseWriter, model interface{}, statusCode int)
	RespondWithPaginatedJSONAPI(w http.ResponseWriter, model interface{}, statusCode int)
}

Writer provides utility functions for responding to http requests

func NewWriter

func NewWriter(logger logger.Logger) Writer

NewWriter creates an instance of Writer

Jump to

Keyboard shortcuts

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