-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathproblem_helpers.go
More file actions
29 lines (24 loc) · 857 Bytes
/
problem_helpers.go
File metadata and controls
29 lines (24 loc) · 857 Bytes
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
package httpsuite
import "net/http"
// ProblemBadRequest returns a bad request problem builder.
func ProblemBadRequest(detail string) *ProblemBuilder {
return Problem(http.StatusBadRequest).
Type(GetProblemTypeURL("bad_request_error")).
Title("Bad Request").
Detail(detail)
}
// ProblemNotFound returns a not found problem builder.
func ProblemNotFound(detail string) *ProblemBuilder {
return Problem(http.StatusNotFound).
Type(GetProblemTypeURL("not_found_error")).
Title("Not Found").
Detail(detail)
}
// NewBadRequestProblem returns a ready-to-use bad request problem.
func NewBadRequestProblem(detail string) *ProblemDetails {
return ProblemBadRequest(detail).Build()
}
// NewNotFoundProblem returns a ready-to-use not found problem.
func NewNotFoundProblem(detail string) *ProblemDetails {
return ProblemNotFound(detail).Build()
}