finalhandler icon indicating copy to clipboard operation
finalhandler copied to clipboard

feat: add `text/plain` fallback response

Open Phillip9587 opened this issue 10 months ago • 4 comments

Based on the work in #56.

Adds a fallback text/plain response when the client does not accept html.

Phillip9587 avatar Mar 05 '25 17:03 Phillip9587

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/[email protected] None 0 28.7 kB wesleytodd

View full report↗︎

socket-security[bot] avatar Mar 05 '25 17:03 socket-security[bot]

@wesleytodd We maybe should use negotiator not accepts because negotiator is more lightweight compared to accepts and we don't need the mime types support from accepts.

Phillip9587 avatar Mar 05 '25 17:03 Phillip9587

Yeah, probably true. Frankly I dislike all the content type negotiation packages we have, they could use some consolidation and cleanup to make it more clear when to use which.

wesleytodd avatar Mar 05 '25 17:03 wesleytodd

I don’t think we can include this in a 2.x release since it introduces a breaking change. Currently, finalhandler always returns a text/html response, and even though changing this might be more correct, it could still potentially break existing users relying on the current behavior.

Phillip9587 avatar Mar 05 '25 20:03 Phillip9587