mirror of
https://github.com/hanzoai/oxy.git
synced 2026-09-30 23:42:31 +00:00
Ok
This commit is contained in:
+13
-13
@@ -12,21 +12,21 @@ Examples of a streaming middleware:
|
||||
w.Write([]byte("hello"))
|
||||
})
|
||||
|
||||
// Stream will read the body in buffer before passing the request to the handler
|
||||
// calculate total size of the request and transform it from chunked encoding
|
||||
// before passing to the server
|
||||
stream.New(handler)
|
||||
// Stream will read the body in buffer before passing the request to the handler
|
||||
// calculate total size of the request and transform it from chunked encoding
|
||||
// before passing to the server
|
||||
stream.New(handler)
|
||||
|
||||
// This version will buffer up to 2MB in memory and will serialize any extra
|
||||
//to a temporary file, if the request size exceeds 10MB it will reject the request
|
||||
stream.New(handler,
|
||||
MemRequestBodyBytes(2 * 1024 * 1024),
|
||||
MaxRequestBodyBytes(10 * 1024 * 104))
|
||||
// This version will buffer up to 2MB in memory and will serialize any extra
|
||||
//to a temporary file, if the request size exceeds 10MB it will reject the request
|
||||
stream.New(handler,
|
||||
MemRequestBodyBytes(2 * 1024 * 1024),
|
||||
MaxRequestBodyBytes(10 * 1024 * 104))
|
||||
|
||||
// Will do the same as above, but with responses
|
||||
stream.New(handler,
|
||||
MemResponseBodyBytes(2 * 1024 * 1024),
|
||||
MaxResponseBodyBytes(10 * 1024 * 104))
|
||||
// Will do the same as above, but with responses
|
||||
stream.New(handler,
|
||||
MemResponseBodyBytes(2 * 1024 * 1024),
|
||||
MaxResponseBodyBytes(10 * 1024 * 104))
|
||||
|
||||
// Stream will replay the request if the handler returns error at least 3 times
|
||||
// before returning the response
|
||||
|
||||
Reference in New Issue
Block a user