Documentation ¶
Index ¶
- func HandleError(w http.ResponseWriter, message string, code int)
- func IsRequestSsz(req *http.Request) bool
- func RespondWithSsz(req *http.Request) bool
- func WriteError(w http.ResponseWriter, errJson HasStatusCode)
- func WriteJson(w http.ResponseWriter, v any)
- func WriteSsz(w http.ResponseWriter, respSsz []byte, fileName string)
- type DefaultJsonError
- type HasStatusCode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleError ¶
func HandleError(w http.ResponseWriter, message string, code int)
func IsRequestSsz ¶
IsRequestSsz checks if the request object should be interpreted as ssz
func RespondWithSsz ¶
RespondWithSsz takes a http request and checks to see if it should be requesting a ssz response.
func WriteError ¶
func WriteError(w http.ResponseWriter, errJson HasStatusCode)
WriteError writes the error by manipulating headers and the body of the final response.
func WriteJson ¶
func WriteJson(w http.ResponseWriter, v any)
WriteJson writes the response message in JSON format.
Types ¶
type DefaultJsonError ¶
DefaultJsonError is a JSON representation of a simple error value, containing only a message and an error code.
func (*DefaultJsonError) Error ¶
func (e *DefaultJsonError) Error() string
func (*DefaultJsonError) StatusCode ¶
func (e *DefaultJsonError) StatusCode() int
type HasStatusCode ¶
type HasStatusCode interface {
StatusCode() int
}
Click to show internal directories.
Click to hide internal directories.