File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,8 @@ func (p *ReverseProxy) init() error {
6868 IsTLS : p .opt .tlsConfig != nil ,
6969 TLSConfig : p .opt .tlsConfig ,
7070 DisablePathNormalizing : p .opt .disablePathNormalizing ,
71+ MaxResponseBodySize : p .opt .maxResponseBodySize ,
72+ StreamResponseBody : p .opt .streamResponseBody ,
7173 }
7274 p .clients = append (p .clients , client )
7375 }
@@ -84,6 +86,8 @@ func (p *ReverseProxy) init() error {
8486 IsTLS : p .opt .tlsConfig != nil ,
8587 TLSConfig : p .opt .tlsConfig ,
8688 DisablePathNormalizing : p .opt .disablePathNormalizing ,
89+ MaxResponseBodySize : p .opt .maxResponseBodySize ,
90+ StreamResponseBody : p .opt .streamResponseBody ,
8791 MaxConnDuration : p .opt .maxConnDuration ,
8892 }
8993 p .clients = append (p .clients , client )
Original file line number Diff line number Diff line change @@ -40,6 +40,12 @@ type buildOption struct {
4040 // disableVirtualHost disable virtual host.
4141 disableVirtualHost bool
4242
43+ // maxResponseBodySize is the maximum response body size in bytes.
44+ maxResponseBodySize int
45+
46+ // streamResponseBody denotes whether stream response body or not.
47+ streamResponseBody bool
48+
4349 // maxConnDuration of hostClient
4450 maxConnDuration time.Duration
4551}
@@ -135,6 +141,14 @@ func WithDisableVirtualHost(isDisableVirtualHost bool) Option {
135141 })
136142}
137143
144+ // WithStreamResponseBody sets whether stream response body or not.
145+ func WithStreamResponseBody (size int ) Option {
146+ return newFuncBuildOption (func (o * buildOption ) {
147+ o .streamResponseBody = true
148+ o .maxResponseBodySize = size
149+ })
150+ }
151+
138152// WithMaxConnDuration sets maxConnDuration of hostClient, which
139153// means keep-alive connections are closed after this duration.
140154func WithMaxConnDuration (d time.Duration ) Option {
You can’t perform that action at this time.
0 commit comments