Feature: Configurable content type handling in wrap-stacktrace-web middleware
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Start at the wrap-stacktrace-web middleware and its ex-response handling described in the issue. Compare the three proposed approaches, then trace how the Accept header currently selects HTML or JSON and how the response content type is set. Done means configurable content-type handling, including application/json, with matching responses and coverage for the supported choices.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Right now, the ring.middleware.stacktrace/wrap-stacktrace-web middleware serves either HTML or JSON depending on the request's accept header. If the request accepts text/javascript, then it serves the stacktrace as JSON; otherwise, it serves it as HTML.
I'd like to be able to configure this behavior. For example, I'd like to be able to serve JSON when the request accepts application/json (in addition to text/javascript) and set the response content type correspondingly. I could also envision being able to configure additional content types as well (e.g. XML, text, EDN).
I'm happy to add this feature myself, but I wanted to know how you'd like to approach it. Here are a few ideas I had.
- Changing
ex-responseto a multimethod that dispatches by matching regular expressions against theacceptheader. This lets users add additional content types and lets them customize the responses themselves. - Adding a configuration option to
wrap-stacktrace-webthat specifies the content type to use for determining whether to respond with JSON. This wouldn't let you configure additional content types. - Changing the regular expression
ex-responseto also acceptapplication/jsonand setting the response content type to whichever one was matched. This wouldn't let you add more content types either.
I prefer the multimethod approach, but multimethods aren't really used anywhere else in the code base. What do you think of the idea and which approach would you go with?
- Lingua principale
- Clojure
- Stelle
- 3.9k
- Fork
- 528
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ring-clojure/ring
-
Typo in wrap-nested-params docstringForse già presa @dajiaohuang l’ha presa 2 giorni fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
ring-clojure/ring#546 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
ring-clojure/ring#544 · 3 commenti ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
ring-clojure/ring#542 · 5 commenti · 2 reazioni ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
ring-clojure/ring#541 · 3 commenti ·
-
[ring-jetty-adapter] No control over exceptions thrown when obtaining item from ISeq response bodyAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
ring-clojure/ring#531 · 4 commenti ·
Tutte le issue di ring-clojure/ring
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
category:tooling
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
.Needs Triage .Team/UXWest Priority:P2 Type:Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
metabase/metabase#83998 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno