Lambda ASP NET Core Server is returning Content-Type Header even on NoContent Response
Maintainer thường phản hồi trong vòng 1 ngày
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
- 68/100
Hướng nghiên cứu
Bắt đầu trong APIGatewayProxyFunction.MarshallResponse tại khoảng dòng 202 và các dòng tiếp theo, sau đó tái hiện phản hồi bằng một endpoint GET đơn giản trả về NoContent() hoặc Ok() bằng apigateway-aws-proxy Lambda template. Hoàn tất khi Content-Type chỉ được ghi vào collection Headers khi phản hồi có nội dung, không có entry multiValueHeaders null đối với phản hồi 204.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
We are using Amazon.Lambda.AspNetCoreServer 6.0.3 and normal ASP Net Controllers and responses.
The ActionResults for NoContent (HTTP 204) and Ok (HTTP 200) are correctly returning HTTP responses with a body and without a content-type header.
The ApiGatewayProxyFunction transforms that result into the following:
{
"statusCode": 204,
"headers": {},
"multiValueHeaders": {
"Content-Type": [
null
]
},
"body": "",
"isBase64Encoded": false
}
There is two Problems with this reponse:
- Content-Type can never be a multiValueHeader. The RFC (https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.2) states that.
- On 204 there should not even be a content-type header (and on 200 with an empty body, probably as well) See the RFC 7231 section 3.1.5.5 for that.
Reproduction Steps
Implement a simple GET Endpoint that returns either NoContent() or Ok() and call it e.g. via the AWS console and the Test Lambda Template for "apigateway-aws-proxy".
The response should be similar to the one above.
Environment
- Build Version: Amazon.Lambda.AspNetCoreServer 6.0.3
- OS Info: Lambda Image public.ecr.aws/lambda/dotnet:6-x86_64
- Build Environment: dotnet lambda toolchain (so SAM Templates)
- Targeted .NET Platform: .NET 6.0
Resolution
- 👋 I can/would-like-to implement a fix for this problem myself
The error should be in APIGatewayProxyFunction.MarshallResponse lines 202 and following.
Content-Type will need to be written to the Headers collection, but only if there is actually content in the response.
This is a 🐛 bug-report
- Ngôn ngữ chính
- C#
- Star
- 1.7k
- Fork
- 505
- Merge trung bình
- 2 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 9
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của aws/aws-lambda-dotnet
-
Annotate auto-generated codeĐang mởfeature-request needs-triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
aws/aws-lambda-dotnet#2588 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Generated XML doc `cref` contains unescaped generic arguments: CS1584 / CS1658 / CS1570 warningsCó thể đã có người làm @reginaldalfret đã nhận 5 ngày trước. Đang mởbug needs-triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
aws/aws-lambda-dotnet#2587 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug needs-triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 67/100
aws/aws-lambda-dotnet#2586 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
feature-request p2
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
aws/aws-lambda-dotnet#2551 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
JSON log format pairs ILogger message template placeholders with state values by position, garbling ASP.NET Core hosting logsCó thể đã có người làm @Pybsama đã nhận 76 ngày trước. Đang mởbug investigating p2
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 70/100
aws/aws-lambda-dotnet#2468 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của aws/aws-lambda-dotnet
Issue tương tự
-
area-signalr
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
dotnet/aspnetcore#69842 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 2 ngày
-
bug needs-triage
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 78/100
microsoft/microsoft-ui-reactor#1373 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Client customer-reported KeyVault needs-team-attention question Service Attention
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Azure/azure-sdk-for-net#63861 · 3 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
:watch: Not Triaged dotnet-csharp/svc fundamentals/subsvc
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày