mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-02 03:00:41 +00:00
Add option to limit example len (#1145)
Do not save OAS example response if it is over the limit. SpecGen.MaxExampleLen is measured in bytes. Limit=0 means "don't record any examples", while limit=-1 means "record all". Limit is configured via the config file / --set: --set oas.max-example-len=100. The default is 10KB. This PR breaks the previous config. Moved oas bool (enable/disable OAS) to oas.enable. Users who wish to disable OAS (or to explicitly enable it) should now to so with --set oas.enable=false instead of --set oas=false. Co-authored-by: Nimrod Gilboa Markevich <nimrod@up9.com> Co-authored-by: Nimrod Gilboa Markevich <59927337+nimrod-up9@users.noreply.github.com>
This commit is contained in:
@@ -34,12 +34,12 @@ func TestGetOASSpec(t *testing.T) {
|
||||
|
||||
func getRecorderAndContext() (*httptest.ResponseRecorder, *gin.Context) {
|
||||
dependency.RegisterGenerator(dependency.OasGeneratorDependency, func() interface{} {
|
||||
return oas.GetDefaultOasGeneratorInstance()
|
||||
return oas.GetDefaultOasGeneratorInstance(-1)
|
||||
})
|
||||
|
||||
recorder := httptest.NewRecorder()
|
||||
c, _ := gin.CreateTestContext(recorder)
|
||||
oas.GetDefaultOasGeneratorInstance().Start()
|
||||
oas.GetDefaultOasGeneratorInstance().GetServiceSpecs().Store("some", oas.NewGen("some"))
|
||||
oas.GetDefaultOasGeneratorInstance(-1).Start()
|
||||
oas.GetDefaultOasGeneratorInstance(-1).GetServiceSpecs().Store("some", oas.NewGen("some"))
|
||||
return recorder, c
|
||||
}
|
||||
|
Reference in New Issue
Block a user