mirror of
https://github.com/retailcrm/mg-transport-core.git
synced 2024-11-24 22:26:04 +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,
|
|
}
|
|
}
|