[Typescript][Angular] Status Code 204: Accept-Content Header
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 62/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- angular, typescript
Research direction
Start in modules/openapi-generator/src/main/resources/Javascript/ApiClient.mustache and inspect how contentTypes are handled for the 204 response in the provided OpenAPI declaration. Generate the TypeScript/Angular client and observe the request headers. Done means the empty 204 response no longer produces an application/json Accept-Content header.
Written by the indexing model from the issue text.
Description
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');
}
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from swagger-api/swagger-codegen
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
swagger-api/swagger-codegen#12755 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
swagger-api/swagger-codegen#12445 ·
-
security vulnerability
Difficulty 1/5 Under an hour Newbie friendliness 62/100
swagger-api/swagger-codegen#11942 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
swagger-api/swagger-codegen#11812 · 1 reaction ·
-
security vulnerability
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
swagger-api/swagger-codegen#11594 ·
All issues in swagger-api/swagger-codegen
Similar issues
-
bug No Code Attached Yet
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
joomla/joomla-cms#48556 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
john-kurkowski/tldextract#382 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
CircuitVerse/CircuitVerse#7967 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
CopilotKit/aimock#491 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
deepset-ai/haystack#13092 ·
Maintainers usually reply within 1 day