🐛 Bug Report: Client.call raises KeyError when error response omits Content-Type

Ouverte
#174 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
35/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
python
Domaine
api, backend

Piste de recherche

Start with the synthetic response reproduction in the issue and inspect appwrite/client.py where Client.call handles the HTTP 502 response. Check how the SDK maps failed responses to AppwriteException, then identify the generator or source that owns this read-only SDK before proposing a change. Done means the missing Content-Type no longer causes KeyError and the original status and body surface through AppwriteException.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

👟 Reproduction steps

With SDK 27.0.0, use a synthetic requests.Response and patch requests.request so no network request is made:

from unittest.mock import patch
from requests import Response
from appwrite.client import Client

response = Response()
response.status_code = 502
response.url = "https://cloud.appwrite.io/v1/synthetic"
response._content = b"upstream unavailable"
response.headers = {}  # valid response without a Content-Type header

with patch("appwrite.client.requests.request", return_value=response):
    Client().call("get", "/synthetic")
👍 Expected behavior

The failed HTTP response should surface as AppwriteException (including its status/body where available), consistent with the SDK's documented error behavior.

👎 Actual Behavior

The call raises KeyError: 'Content-Type' from appwrite/client.py while handling the HTTP 502, hiding the original HTTP failure and bypassing AppwriteException.

🎲 Appwrite version

Different version (specify in environment): SDK package 27.0.0; no live Appwrite server was used.

💻 Operating system

Windows

🧱 Your Environment

CPython 3.13, requests 2.34.2. The reproduction patches the request function and uses only a synthetic response; it sends no network request and uses no credentials.

👀 Have you spent some time to check if this issue has been raised before?
  • I checked and didn't find a similar issue. I reviewed the related client-error report #108 and searched existing issues for Content-Type and KeyError AppwriteException; neither reports this missing-header failure.
🏢 Have you read the Code of Conduct?
  • I have read the Code of Conduct

The SDK README describes this repository as auto-generated, and the repository's bot told PR #162 that direct pull requests are not accepted. I'm reporting the reproducible behavior here rather than editing generated code; please route the fix through the appropriate generator/source if applicable.

Langage dominant
Python
Étoiles
265
Forks
68
Merge moyen
5 h 2 min
PR mergées (30 j)
8

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de appwrite/sdk-for-python

Toutes les issues de appwrite/sdk-for-python

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.