-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.go
45 lines (39 loc) · 970 Bytes
/
client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package boom
import "net/http"
func BadRequest(message string, data interface{}) *ErrorMessage {
return &ErrorMessage{
Code: http.StatusBadRequest,
Error: "Bad Request",
Message: message,
Data: data,
}
}
func Unauthorized(message string) *ErrorMessage {
// TODO: Support other params like https://github.com/hapijs/boom#boomunauthorizedmessage-scheme-attributes
return &ErrorMessage{
Code: http.StatusUnauthorized,
Error: "Bad Request",
Message: message,
}
}
func PaymentRequired(message string) *ErrorMessage {
return &ErrorMessage{
Code: http.StatusPaymentRequired,
Error: "Payment Required",
Message: message,
}
}
func Forbidden(message string) *ErrorMessage {
return &ErrorMessage{
Code: http.StatusForbidden,
Error: "Forbidden",
Message: message,
}
}
func NotFound(message string) *ErrorMessage {
return &ErrorMessage{
Code: http.StatusNotFound,
Error: "Not Found",
Message: message,
}
}