Coder Social home page Coder Social logo

Comments (3)

whickman avatar whickman commented on May 29, 2024 1

yep that is a mis-characterization on my part, sorry. Request is certainly fully in memory before being written to buffer and we would be creating a second copy.

That's a fair point. Given that and need for signed requests etc, supporting reading the body is reasonable. I'll follow up off the issue on prioritization / implementation

Not a huge fan of the amount of optionality we are providing people in middleware given how much skew that is causing across consumers, but that is a conversation for a different time.

(CGR already supports reading the response body in the error middleware, which seems potentially dangerous to me anyway...)

from conjure-go-runtime.

whickman avatar whickman commented on May 29, 2024

reading the request body means you'll need to load the entire request into memory, rather than allowing it to be read incrementally, as is done now. For that reason, we want to discourage middleware working with the request (and response) body

from conjure-go-runtime.

avisbal avatar avisbal commented on May 29, 2024

cc: @najork

Is the request body actually read incrementally? It looks like it's encoded to a buffer in bodyMiddleware, which I thought would write the entire encoded request body to the buffer in memory.

bodyMiddleware sets request.GetBody, whose intended purpose is to allow reading the request body more than once client-side, right? I think it's appropriate to note that using that method will increase memory utilization, i.e. because it creates a copy of the request body, but that seems like tradeoff that can be made when authoring or using middleware as opposed to restricting it from being used.

from conjure-go-runtime.

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.