Fix HTTP status code check to accept 201 Created

- Change decodeJsonFromRequest to accept all 2xx status codes (200-299)
- Previously only accepted status 200, causing 201 Created to be treated as error
- Vikunja API returns 201 when creating tasks, which is correct HTTP behavior
- This was the root cause of "unexpected status code 201" error

Co-authored-by: Mord0reK <135718526+Mord0reK@users.noreply.github.com>
pull/878/head
copilot-swe-agent[bot] 2025-11-17 13:36:49 +07:00
parent e6aff6d032
commit 71972a65ef
1 changed files with 1 additions and 1 deletions

@ -73,7 +73,7 @@ func decodeJsonFromRequest[T any](client requestDoer, request *http.Request) (T,
return result, err
}
if response.StatusCode != http.StatusOK {
if response.StatusCode < 200 || response.StatusCode >= 300 {
truncatedBody, _ := limitStringLength(string(body), 256)
return result, fmt.Errorf(