BUG: lambdaurl.Wrap still does not add Content-Length headers?
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start at the lambdaurl.Wrap implementation and compare its ResponseWriter behavior with the net/http behavior described in the issue. Reproduce the provided /hello handler locally through lambdaurl, then verify that a small response returns the expected Content-Length and body instead of Content-Length: 0.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is.
Following https://github.com/aws/aws-lambda-go/issues/508,
The
http.ResponseWriterimplementation says the following thing about Content-Type header (and it actually has a note about Content-Length too).If WriteHeader has not yet been called, Write calls
WriteHeader(http.StatusOK) before writing the data. If the Header
does not contain a Content-Type line, Write adds a Content-Type set
to the result of passing the initial 512 bytes of written data to
DetectContentType. Additionally, if the total size of all written
data is under a few KB and there are no Flush calls, the
Content-Length header is added automatically.As of right now the
lambdaurl.Wrapimplementation completely misses this . . .
which get closed as a part of https://github.com/aws/aws-lambda-go/releases/tag/v1.42.0
However a quick search of Content-Length in the change log of
https://github.com/aws/aws-lambda-go/compare/v1.41.0...v1.42.0
did not get any hits:
Are the Content-Length headers being added now?
Describe the solution you'd like
Add the Content-Length headers, properly.
Additional context
For a handler like:
mux.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(200)
_, _ = w.Write([]byte("Hello World!"))
})
I was able to get return from it if I try it locally, However, if using lambdaurl, I got empty returns, i.e., Content-Length: 0.
Please double-check. Thanks
- Dominant language
- Go
- Stars
- 3.8k
- Forks
- 578
- Avg merge
- 16h 56m
- Merged PRs (30d)
- 2
Contributor 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 aws/aws-lambda-go
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
aws/aws-lambda-go#634 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
aws/aws-lambda-go#597 · 3 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
aws/aws-lambda-go#556 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
aws/aws-lambda-go#610 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
aws/aws-lambda-go#598 ·
All issues in aws/aws-lambda-go
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
crossplane/crossplane#7859 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bazel-contrib/rules_go#4721 · 2 comments ·
-
needs-triage
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
bug carvel-triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
carvel-dev/kapp-controller#1861 ·
-
area/logging kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100