Git Product home page Git Product logo

Comments (4)

josevalim avatar josevalim commented on September 23, 2024

I don't believe we should return parsed data from the headers. I would rather like to see a collection of parsing functions or functions that return the parsed data. For example, we could add Plug.Conn.last_modified/1 and Plug.Conn.if_modified_since/1. In any case, we should definitely not depend on cowboy for any of the implementations. :)

from plug.

mtwilliams avatar mtwilliams commented on September 23, 2024

That seems like a better approach. It does mean implementing more in Plug, but is much much cleaner.

I am open to implementing:

  • Plug.Conn.accept/1
  • Plug.Conn.accept_charset/1
  • Plug.Conn.accept_encoding/1
  • Plug.Conn.accept_language/1
  • Plug.Conn.authorization/1
  • Plug.Conn.content_length/1
  • Plug.Conn.content_type/1
  • Plug.Conn.cookie/1
  • Plug.Conn.expect/1
  • Plug.Conn.if_match/1
  • Plug.Conn.if_modified_since/1
  • Plug.Conn.if_none_match/1
  • Plug.Conn.if_unmodified_since/1
  • Plug.Conn.range/1
  • Plug.Conn.sec_websocket_protocol/1
  • Plug.Conn.transfer_encoding/1
  • Plug.Conn.upgrade/1
  • Plug.Conn.x_forwarded_for/1

With redundant ones (like Plug.Conn.cookie/1) skipped, of course.

from plug.

josevalim avatar josevalim commented on September 23, 2024

That sounds like a good plan but I would like to hold on this for now. The main issue is that we import everything in Plug.Conn and those functions they are less used than usual... maybe the should be in Plug.Headers or something of sorts. I am very swamped with 1.0 right now so I can't put much thought into it right now (and seeing some use cases would help sway one way or the other.

from plug.

josevalim avatar josevalim commented on September 23, 2024

I am closing this. I would like to tackle this one a case per case basis. For example, if people want to use Last-Modified, we can add support for that. We cannot rely on the adapter though, we need to do the parsing ourselves.

from plug.

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.