BUG: lambdaurl.Wrap still does not add Content-Length headers?
Personne n'a encore pris cette issue.
- Langage dominant
- Go
- Étoiles
- 3.8k
- Forks
- 578
- Merge moyen
- 8 h 18 min
- PR mergées (30 j)
- 1
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
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par l’implémentation de lambdaurl.Wrap et comparez le comportement de ResponseWriter avec celui de net/http décrit dans l’issue. Reproduisez localement le handler /hello fourni via lambdaurl, puis vérifiez qu’une réponse de petite taille renvoie le Content-Length et le body attendus au lieu de Content-Length: 0.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- aws, go
- Domaine
- api, backend, cloud
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100