CenterForDigitalHumanities / CenterForDigitalHumanities/rerum_server_nodejs

`Content-Type` Header Processing

Abierto
#175 3 comentarios 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
JavaScript
Estrellas
3
Forks
6
Merge medio
1 h 25 min
PR fusionados (30 d)
3

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Rastrea los handlers de las solicitudes para /create, los endpoints update-y y /query, y luego inspecciona cómo se analizan Content-Type y los cuerpos de las solicitudes. Verifica el comportamiento con solicitudes a las que les falte el header, que usen tipos JSON no compatibles o que contengan cuerpos vacíos o no válidos; se considera terminado cuando cada caso no válido devuelve 400 con un mensaje útil y las solicitudes JSON válidas siguen teniendo éxito sin crear objetos vacíos.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript
Área
api, backend
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
55/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.