Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Django integration is incompatible with Django REST Framework

Aperta
#247 0 commenti 3 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
django, python
Ambito
api, backend

Direzione di ricerca

Review the DjangoOpenAPIRequest class and the linked Django REST Framework issue first. Compare request.body and request.data behavior for a DRF Request, then determine an integration approach; done means DRF requests no longer fail because POST data is read twice.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area/contrib help wanted

The DjangoOpenAPIRequest class accesses request.body. This can cause issues related to reading the POST data twice, as described here:

https://github.com/encode/django-rest-framework/issues/2774

I have found that DRF accesses the request.body to read the CSRF token so the mitigation steps described in the issue above do not work. I have a branch of openapi-core here:

https://github.com/jrtcppv/openapi-core

That instead reads request.data and bypasses the deserialization of the request body. This is probably not the right solution as it is, but it might be possible to inspect the type of the request and do something different if it is not a normal django HttpRequest class, but rather the Request class provided by DRF.

I also tried subclassing DRF's APIView and overriding the intialize_request function, returning a subclass of Request that contained the parameters parsed by openapi-core. This also worked and might be an option if there needs to be a separate integration just for DRF.

Anyway, thanks for the library!

Lingua principale
Python
Stelle
368
Fork
140
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di python-openapi/openapi-core

Tutte le issue di python-openapi/openapi-core

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.