diff options
author | 2023-07-30 15:33:56 -0700 | |
---|---|---|
committer | 2023-07-30 15:52:49 -0700 | |
commit | e7ccf0aa1e4fc7b118042a2d31ee61583ac796a8 (patch) | |
tree | e75f9646f7f18aabefb4b68a070fb13d316623d6 /http/response/json/json.go | |
parent | e2fb77bd85cf8db966c9b064ae37725d8d0664df (diff) | |
download | v2-e7ccf0aa1e4fc7b118042a2d31ee61583ac796a8.tar.gz v2-e7ccf0aa1e4fc7b118042a2d31ee61583ac796a8.tar.zst v2-e7ccf0aa1e4fc7b118042a2d31ee61583ac796a8.zip |
Add SaveEntry function to API client
Diffstat (limited to 'http/response/json/json.go')
-rw-r--r-- | http/response/json/json.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/http/response/json/json.go b/http/response/json/json.go index 3033045d..17eca55a 100644 --- a/http/response/json/json.go +++ b/http/response/json/json.go @@ -39,6 +39,13 @@ func NoContent(w http.ResponseWriter, r *http.Request) { builder.Write() } +func Accepted(w http.ResponseWriter, r *http.Request) { + builder := response.New(w, r) + builder.WithStatus(http.StatusAccepted) + builder.WithHeader("Content-Type", contentTypeHeader) + builder.Write() +} + // ServerError sends an internal error to the client. func ServerError(w http.ResponseWriter, r *http.Request, err error) { logger.Error("[HTTP:Internal Server Error] %s => %v", r.URL, err) @@ -68,7 +75,7 @@ func Unauthorized(w http.ResponseWriter, r *http.Request) { builder := response.New(w, r) builder.WithStatus(http.StatusUnauthorized) builder.WithHeader("Content-Type", contentTypeHeader) - builder.WithBody(toJSONError(errors.New("Access Unauthorized"))) + builder.WithBody(toJSONError(errors.New("access unauthorized"))) builder.Write() } @@ -79,7 +86,7 @@ func Forbidden(w http.ResponseWriter, r *http.Request) { builder := response.New(w, r) builder.WithStatus(http.StatusForbidden) builder.WithHeader("Content-Type", contentTypeHeader) - builder.WithBody(toJSONError(errors.New("Access Forbidden"))) + builder.WithBody(toJSONError(errors.New("access forbidden"))) builder.Write() } @@ -90,7 +97,7 @@ func NotFound(w http.ResponseWriter, r *http.Request) { builder := response.New(w, r) builder.WithStatus(http.StatusNotFound) builder.WithHeader("Content-Type", contentTypeHeader) - builder.WithBody(toJSONError(errors.New("Resource Not Found"))) + builder.WithBody(toJSONError(errors.New("resource not found"))) builder.Write() } |