response

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: MPL-2.0 Imports: 8 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 string) 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