Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

🐛 Bug: Newsletter API returns 500 for a non-form request body

Chiusa Adatta ai principianti
#166 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 4 giorni

@JoshuaKGoldberg ci sta già lavorando.

Dal 1/10/2026.

  • #168 di @JoshuaKGoldberg — aperta

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
88/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
api, backend

Direzione di ricerca

Leggi src/pages/api/newsletter.ts e segui come l’handler chiama request.formData() e restituisce la risposta esistente "Invalid body". Riproduci il problema con la richiesta curl fornita, quindi verifica che un body che non è un form riceva 400 invece di 500, mentre le richieste con form valide continuano a funzionare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

status: accepting prs type: bug
Bug Report Checklist
  • I have tried restarting my IDE and the issue persists.
  • I have pulled the latest main branch of the repository.
  • I have searched for related issues and found none that matched my issue.
Expected

A POST to /api/newsletter with a body that is not form data, such as application/json, should get a 400 response.

Actual

request.formData() in src/pages/api/newsletter.ts throws on a JSON body, and the error is not caught, so the route responds with a 500. Reproduced with curl -X POST -H 'content-type: application/json' -d '{}' /api/newsletter.

Additional Info

Astro's origin check only covers form content types, which is why this body shape reaches the handler at all. Catching the parse failure and returning the existing "Invalid body" 400 is enough.

🩵

Lingua principale
Astro
Stelle
12
Fork
8
Merge medio
3g 2h
PR unite (30g)
57

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di SquiggleTools/SquiggleConf.com

Tutte le issue di SquiggleTools/SquiggleConf.com

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.