Consider using HTTP error response statuses where appropriate
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 35/100
Piste de recherche
Start by locating the Scotty route handlers and the nginx configuration for compile.purescript.org. Review how oversized bodies, compilation failures, missing endpoints, and deployment failures currently respond; done means the appropriate HTTP statuses and CORS behavior are defined and applied consistently.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Right now, the API server returns 200 responses basically unconditionally. The readme says:
Among other things, this makes it easier to use the API from another domain using CORS.
But I don't think this is quite true, because according to my reading of the CORS spec, 4xx and 5xx responses should be visible as long as the appropriate Access-Control-Allow-Origin header is set. It's only preflight requests which must return 2xx responses for the request to succeed, and we don't need to use those because we only use "simple methods" (GET and POST).
I think a 200 response in the case where the code failed to compile is appropriate, but I don't think it's appropriate in a case where we are refusing the process the request because the body is too large; the 413 Request Entity Too Large response seems more appropriate for that. I'm not sure what the best way to handle modules not called Main is.
Relatedly, I think we should add the appropriate CORS headers (in particular Access-Control-Allow-Origin: *) for compile.purescript.org in nginx, rather that on the individual scotty routes as we are doing currently. This way, clients from different origins would be able to handle errors which occur outside of the handling of those particular routes in Scotty, such as 404s for non existent endpoints, or 502s for if a deployment has gone wrong.
- Langage dominant
- PureScript
- Étoiles
- 121
- Forks
- 51
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
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.
Autres issues de purescript/trypurescript
-
Add options for bare-bones use Ouverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
purescript/trypurescript#309 ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
purescript/trypurescript#308 ·
-
Publish as a library Ouverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
purescript/trypurescript#303 · 1 commentaire ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
purescript/trypurescript#301 · 1 commentaire · 1 réaction ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 35/100
purescript/trypurescript#293 · 7 commentaires ·
Toutes les issues de purescript/trypurescript
Issues similaires
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
avniproject/avni-client#2135 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
use-agent-os/agent-os#3276 ·
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
-
good first issue refactor
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100