Comments (3)
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.
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.
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)
- Every http status code >400 is retried HOT 1
- retry count is off by 1
- Mio HOT 1
- Albert HOT 1
- Support any number of attempts from [1, inf) on transport errors
- Consider Typing Errors for Requests with Nil Responses HOT 4
- CGR HTTP client double encodes URL parameters
- Improve http client retry behavior across requests when a URI(s) is unavailable HOT 1
- TLS configuration is not refreshable
- NewHTTPClient doesn't add metricsMiddleware
- Errors only allow being registered once despite conjure allowing a package to be generated multiple times HOT 1
- Should WithRawResponseBody be opinionated about content type?
- Consider Supporting 429 Throttling HOT 5
- Stop supporting user-defined error decoders HOT 1
- Move retry logic into middleware
- Vendoring of UUID generates conflicts HOT 2
- httpclient.WithRawRequestBodyProvider does not set GetBody() HOT 3
- Consider gjson or json-iterator for faster json operations
- Use BytesBufferPool in restErrorDecoder
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from conjure-go-runtime.