CenterForDigitalHumanities / CenterForDigitalHumanities/rerum_server_nodejs

`Content-Type` Header Processing

Aperta
#175 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
JavaScript
Stelle
3
Fork
6
Merge medio
1h 25m
PR unite (30g)
3

Descrizione

The bug is that RERUM will create an empty object in the following scenario.

![image](https://github.com/CenterForDigitalHumanities/rerum_server_nodejs/assets/3287006/0d15ac98-c984-4875-b256-6fdb090bed13)

> Note: If you do not omit the 'Content-Type' header from this request, RERUM correctly responds with a 400 and a good message.

When a request to `/create` (and likely others) happens and the request does not contain "Content-Type: application/json" but the body is a valid string or empty, RERUM processes the request and creates an empty object in the database. It responds 201 with that empty object as JSON in the body, and client applications receive the 201 with the empty object.

When a request to /create, any of the update-y endpoints, or /query comes in, it MUST contain the 'Content-Type' header, the value for the header has to a supported JSON type (application/json), the body MUST NOT be empty and MUST contain valid JSON with at least on key:value pair.

If any of these conditions are not met, RERUM should respond 400 - Bad Request with as detailed of a message as is useful.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.