Ring wrap-file-info deprecation help


#1

@ericnormand In your original web dev in clojure part 2 video you had wrap-file-info was used as middleware. This has been deprecated and the new wrap-content-type unfortunately doesn’t like the ring response and visiting the site results in safari downloading a Unknown.dms file which contains the raw html response. Any advice here?

@weavejester on clojurians slack seemed to indicate that we should be using compojure to destructure and return a string not the entire ring response, but it was a bit over my head.


#2

@ericnormand here’s what i was able to come up with thus far to make things work (however it includes flat out dropping the wrap-file-info middleware)

PS “listopia” started as me working through your video and has become my playground for exploring web dev in clojure. :slight_smile:


#3

@ericnormand after a rollercoaster ride of feeling really dumb after talking to weavejester, i worked through this and have a much better understanding of things. here’s the pull request on my project that “fixes” this up for me.


#4

Hey @chadhs,

Great job figure all of this out!

It is unfortunate that wrap-file-info was deprecated. I just rewrote the notes but did not notice that.

I was always skeptical of the middleware that set up a bunch of stuff for you, especially in a teaching context. They obscure what’s going on. However, I think I should take a new look at them because they may be a better path for beginners. What do you think?

Thanks
Eric


#5

I completely agree with the obscuring problem for teaching. I also think that it provides some safety.

My gut would be to build up the middleware that is needed like you already do and then later in the lesson talk about wrap-defaults and the benefit and how to use it while overriding some of the defaults if needed.

Keep up the awesome work in the Clojure community!

Chad