mirror of
https://github.com/retailcrm/mg-transport-core.git
synced 2024-11-22 21:26:05 +03:00
18 lines
355 B
Go
18 lines
355 B
Go
package core
|
|
|
|
import "net/http"
|
|
|
|
// ErrorResponse struct
|
|
type ErrorResponse struct {
|
|
Error string `json:"error"`
|
|
}
|
|
|
|
// BadRequest returns ErrorResponse with code 400
|
|
// Usage (with gin):
|
|
// context.JSON(BadRequest("invalid data"))
|
|
func BadRequest(error string) (int, interface{}) {
|
|
return http.StatusBadRequest, ErrorResponse{
|
|
Error: error,
|
|
}
|
|
}
|