Improves API client response handling and idempotency
Extends `X-Idempotency-Key` header usage to `DELETE` and `PUT` requests, ensuring idempotent behavior for a wider range of modifying API operations. Updates the documentation and client implementation for `DELETE` requests. Refactors `handleResponse` to robustly parse API responses. It now reads the response body once as text, enabling graceful handling of non-JSON error bodies and consistent processing of successful or empty responses.
This commit is contained in:
@@ -610,7 +610,7 @@ Her API isteğine (`login` ve `refresh` dahil) aşağıdaki header'lar eklenir:
|
||||
| `X-Signature` | hex string | HMAC-SHA256 imzası (bkz. aşağısı) |
|
||||
| `X-Timestamp` | `Date.now()` string | Unix epoch, milisaniye |
|
||||
| `X-Nonce` | UUID v4 | Her istekte tekil, replay saldırısı önleme |
|
||||
| `X-Idempotency-Key` | UUID v4 | Yalnızca `POST` ve `PATCH` isteklerinde |
|
||||
| `X-Idempotency-Key` | UUID v4 | `POST`, `PUT`, `PATCH` ve `DELETE` isteklerinde |
|
||||
|
||||
### HMAC-SHA256 İmza Hesabı
|
||||
|
||||
@@ -664,7 +664,7 @@ X-Signature = HMAC-SHA256(imzalanacak, secret) → "7be41d..."
|
||||
| `X-Signature` | ✅ | ✅ | ✅ |
|
||||
| `X-Timestamp` | ✅ | ✅ | ✅ |
|
||||
| `X-Nonce` | ✅ | ✅ | ✅ |
|
||||
| `X-Idempotency-Key` | ✅ | ✅ | ✅ (POST/PATCH) |
|
||||
| `X-Idempotency-Key` | ✅ | ✅ | ✅ (POST/PUT/PATCH/DELETE) |
|
||||
|
||||
### Güvenlik Önerileri
|
||||
|
||||
|
||||
Reference in New Issue
Block a user