mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
feat(http): implement missing findByID methods (#1635)
* feat(http): implement missing methods * general cleanup * unify param handling * handle not found errors * unify err handlers * fix(http): fmt type
This commit is contained in:
parent
accc875960
commit
acb91e8709
15 changed files with 379 additions and 422 deletions
|
@ -20,7 +20,7 @@ type statusResponse struct {
|
|||
Status int `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
func (e encoder) StatusResponse(w http.ResponseWriter, status int, response interface{}) {
|
||||
func (e encoder) StatusResponse(w http.ResponseWriter, status int, response any) {
|
||||
if response != nil {
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
w.WriteHeader(status)
|
||||
|
@ -52,7 +52,7 @@ func (e encoder) StatusCreated(w http.ResponseWriter) {
|
|||
w.WriteHeader(http.StatusCreated)
|
||||
}
|
||||
|
||||
func (e encoder) StatusCreatedData(w http.ResponseWriter, data interface{}) {
|
||||
func (e encoder) StatusCreatedData(w http.ResponseWriter, data any) {
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
w.WriteHeader(http.StatusCreated)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue