Giter VIP home page Giter VIP logo

Comments (5)

cldwalker avatar cldwalker commented on May 22, 2024

I thought the default used to be text/plain. Are you suggesting that or text/html as the default? I'm for the latter since most of us render html not plain text

from pedestal.

avescodes avatar avescodes commented on May 22, 2024

I agree it should be text/html, but regardless, this is a weird bug where a default is being squashed.

from pedestal.

subhash avatar subhash commented on May 22, 2024

This was a bug that bit me early on, so I am partial to it :-)

As far as I can see, ring.util.response/response is returning an empty header whereas io.pedestal.service.http/html-body is using ring.util.response/content-type to explicitly set the content-type to "text/html;charset=UTF-8". Would it make sense to do the same within ring.util.response/response function (pass it through content-type with a suitable default content-type)?

I know this would work because if I change the definition of home-page this way, the bug ceases to exist:

(defn home-page
  [request]
  (resp/content-type (response "Hello World!") "text/html"))

from pedestal.

avescodes avatar avescodes commented on May 22, 2024

I'm going to work on fixing this.

from pedestal.

avescodes avatar avescodes commented on May 22, 2024

Regardless of what the default content type should be, I wrote a test (see mention) that fails like so:

expected: (= "text/plain" (get-in response [:headers "Content-Type"]))
  actual: (not (= "text/plain" "application/octet-stream"))

Talking with @timewald it seems like we may need our own implementation of content-type-response. (I should also write a failing test in the ring middlewares test ns when I do that.)

from pedestal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.