[Typescript][Angular] Status Code 204: Accept-Content Header
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 62/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- angular, typescript
调研方向
从 modules/openapi-generator/src/main/resources/Javascript/ApiClient.mustache 开始,检查提供的 OpenAPI 声明中如何处理 204 响应的 contentTypes。生成 TypeScript/Angular 客户端并观察请求头。当空的 204 响应不再产生 application/json Accept-Content 请求头时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Description
Wrong Accept-Content Header for empty response types
Swagger-codegen version
3.0.14
Swagger declaration file content or url
delete:
operationId: deletePartnerByID
tags:
-Partner
summary: Deletes a communication partner
parameters:
- name: deletePartnerByID
in: path
description: ID of partner to delete
required: true
schema:
type: integer
format: int64
responses:
204:
description: OK
400:
description: Invalid ID supplied
content:
application/json: {}
404:
description: Communication partner not found
content:
application/json: {}
Command line used for generation
not needed
Steps to reproduce
Follow the Guideline How to make OpenAPI 3.0 to send an empty Accept-Content Header
https://swagger.io/docs/specification/describing-responses/
(In Our Case for HTTP Status code 204)
Test the generated code.
Watch Request Headers
See Accept-Content Header "application/json"
Related issues/PRs
Suggest a fix/enhancement
Fix this code in modules/openapi-generator/src/main/resources/Javascript/ApiClient.mustache
var contentType = this.jsonPreferredMime(contentTypes);
if (contentType) {
if(contentType != 'multipart/form-data') {
request.type(contentType);
}
} else if (!request.header['Content-Type']) {
request.type('application/json');
}
- 主要语言
- Mustache
- 星标
- 17.8k
- 派生
- 6k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
swagger-api/swagger-codegen 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
swagger-api/swagger-codegen#12755 ·
-
难度 2/5 1-3 小时 新手友好度 62/100
swagger-api/swagger-codegen#12445 ·
-
security vulnerability
难度 1/5 1 小时以内 新手友好度 62/100
swagger-api/swagger-codegen#11942 ·
-
[JAVA] Non compilable enums generated with property errorOnUnknownEnum=true可能已有人在做 @HiagoW 于 1461 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
swagger-api/swagger-codegen#11812 · 1 个 reaction ·
-
security vulnerability
难度 2/5 1-3 小时 新手友好度 65/100
swagger-api/swagger-codegen#11594 ·
查看 swagger-api/swagger-codegen 的全部 Issue
相似的 Issue
-
PHP workflow streaming requests buffer the full SSE response可能已有人在做 @Winoren 今天认领。 未关闭review: medium
难度 2/5 1-3 小时 新手友好度 84/100
langgenius/dify#44270 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
bug customer-reported
难度 1/5 1 小时以内 新手友好度 90/100
MagnaCapax/PMSS#1085 ·
维护者通常 5 天内回复
-
Realtime: ASR EOU language tags leak into the LLM conversation (unintended reply-language switching)可能已有人在做 @nexxtmobile 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
founders_reward panics on a configured Testnet when the slow-start subsidy is not a multiple of 5未关闭external-contribution
难度 2/5 1-3 小时 新手友好度 78/100
ZcashFoundation/zebra#11792 ·
维护者通常 1 天内回复