Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[Typescript][Angular] Status Code 204: Accept-Content Header

Đang mở Phù hợp với người mới
#9,892 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
62/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
angular, typescript
Lĩnh vực
api, tooling

Hướng nghiên cứu

Bắt đầu trong modules/openapi-generator/src/main/resources/Javascript/ApiClient.mustache và kiểm tra cách contentTypes được xử lý cho phản hồi 204 trong khai báo OpenAPI được cung cấp. Tạo client TypeScript/Angular và quan sát các header của request. Hoàn tất khi phản hồi 204 rỗng không còn tạo ra header Accept-Content application/json.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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');
    }
Ngôn ngữ chính
Mustache
Star
17.8k
Fork
6k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của swagger-api/swagger-codegen

Tất cả issue của swagger-api/swagger-codegen

Issue tương tự

Thêm issue về Backend & API Design

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.