Git Product home page Git Product logo

Comments (4)

tomchristie avatar tomchristie commented on July 23, 2024

No pressing need for this.

from starlette.

berislavlopac avatar berislavlopac commented on July 23, 2024

I have recently run into the need to hash requests, so I have two questions potentially related to this issue:

  1. Which is the immutable part of a Request that can currently be used for hashing?
  2. Is it better to have requests mutable? After all, a request is something received from outside as is, and if we need to create one internally we should build a new one. Or am I looking at this completely wrong?

Thank you!

from starlette.

tomchristie avatar tomchristie commented on July 23, 2024

Which is the immutable part of a Request that can currently be used for hashing?

The scope represents the state, although the receive/send channels necessarily represent non-hashable elements of the request. Question really is - what do you mean wrt. hashing requests, and what's the intent? Do you want to uniquely identify each incoming request individually, or do you want to do something where the "uniqueness" is a property of the method and request URL?

Is it better to have requests mutable?

Mixed bag. It'd be a benefit if it promotes clearer development practice.

from starlette.

berislavlopac avatar berislavlopac commented on July 23, 2024

Well I was looking at SQLAlchemy and its approach to sessions (as per https://docs.sqlalchemy.org/en/13/orm/contextual.html#unitofwork-contextual), which got me thinking about (im)mutability of requests in general. (I am aware of the issues with using sync libraries with async framework, and I am also aware -- and have used -- the databases and orm projects; just been experimenting a bit.)

from starlette.

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.