CenterForDigitalHumanities / CenterForDigitalHumanities/rerum_server_nodejs

`Content-Type` Header Processing

未关闭
#175 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
JavaScript
星标
3
派生
6
平均合并
2 天 47 分钟
30 天内合并 PR
4

描述

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.

贡献指南

打开贡献指南

调研方向

跟踪 /create、update-y 端点和 /query 的请求处理器,然后检查 Content-Type 和请求体的解析方式。使用缺少 header、使用不受支持的 JSON 类型,或包含空请求体或无效请求体的请求验证行为;完成的标准是每个无效情况都返回 400 和有用的消息,并且有效的 JSON 请求仍能成功,同时不会创建空对象。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
api, backend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
55/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。