Example #1
0
func (self ValidationError) Respond(c httpcontext.HTTPContextLogger) error {
	if self.Fields != nil {
		c.Resp().Header().Set("Content-Type", "application/json; charset=UTF-8")
	}
	if self.Status != 0 {
		c.Resp().WriteHeader(self.Status)
	}
	return json.NewEncoder(c.Resp()).Encode(self)
}
Example #2
0
func (self ErrNoSuchEntity) Respond(c httpcontext.HTTPContextLogger) (err error) {
	c.Resp().WriteHeader(404)
	_, err = fmt.Fprint(c.Resp(), self.Error())
	return
}