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

Feature: Configurable content type handling in wrap-stacktrace-web middleware

Aperta
#121 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
clojure
Ambito
backend

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

enhancement

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.

  1. Changing ex-response to a multimethod that dispatches by matching regular expressions against the accept header. This lets users add additional content types and lets them customize the responses themselves.
  2. Adding a configuration option to wrap-stacktrace-web that specifies the content type to use for determining whether to respond with JSON. This wouldn't let you configure additional content types.
  3. Changing the regular expression ex-response to also accept application/json and 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

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 ring-clojure/ring

Tutte le issue di ring-clojure/ring

Issue simili

Altre issue su Clojure

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.