efritz/chevron

View on GitHub
middleware/response_factory.go

Summary

Maintainability
A
0 mins
Test Coverage
package middleware

import (
    "net/http"

    "github.com/efritz/response"
)

type (
    ResponseFactory   func() response.Response
    ErrorFactory      func(error) response.Response
    PanicErrorFactory func(interface{}) response.Response
)

func defaultErrorFactory(val error) response.Response {
    return response.Empty(http.StatusInternalServerError)
}

func defaultPanicErrorFactory(val interface{}) response.Response {
    return response.Empty(http.StatusInternalServerError)
}