-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add fail_if_body_too_large
http probe option
#1276
base: master
Are you sure you want to change the base?
Add fail_if_body_too_large
http probe option
#1276
Conversation
81b9317
to
1e0ff2b
Compare
@@ -550,7 +550,7 @@ func ProbeHTTP(ctx context.Context, target string, module config.Module, registr | |||
|
|||
if !requestErrored { | |||
_, err = io.Copy(io.Discard, byteCounter) | |||
if err != nil { | |||
if err != nil && (errors.Is(err, &http.MaxBytesError{}) || httpConfig.GetFailIfBodyTooLarge()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check if this is okay or if I should move this to another if
so it's clearer.
@@ -450,6 +451,13 @@ func (s *HeaderMatch) UnmarshalYAML(unmarshal func(interface{}) error) error { | |||
return nil | |||
} | |||
|
|||
func (h HTTPProbe) GetFailIfBodyTooLarge() bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively I could do the nil
check in UnmarshalYAML
, but then it could panic if someone changes the variable under the hood later on.
This can be used in conjunction with `body_size_limit` when it is expected that endpoints return a body larger than the specified limit, e.g. streaming endpoints that potentially return infinite data. Signed-off-by: Justin Kromlinger <[email protected]>
1e0ff2b
to
2d225ab
Compare
Do you want any changes here? Or is this a feature you don't want merged? |
Signed-off-by: Justin Kromlinger <[email protected]>
2a3f154
to
1512b95
Compare
This can be used in conjunction with
body_size_limit
when it is expected that endpoints return a body larger than the specified limit, e.g. streaming endpoints that potentially return infinite data.