Skip to content

Commit 372a7ab

Browse files
authored
Merge pull request #39 from signalsciences/extend_ct
Added new config option for more granular inspection
2 parents d5a7ec3 + 4bb1360 commit 372a7ab

File tree

6 files changed

+21
-3
lines changed

6 files changed

+21
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Golang Module Release Notes
22

3+
## 1.13.0 2023-07-06
4+
5+
* Added new module configuration option for more granular inspection
6+
37
## 1.12.1 2023-02-24
48

59
* Sync versions

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The MIT License (MIT)
44

5-
Copyright (c) 2019-2022 Signal Sciences Corp.
5+
Copyright (c) 2019-2023 Signal Sciences Corp.
66

77
Permission is hereby granted, free of charge, to any person obtaining a copy
88
of this software and associated documentation files (the "Software"), to deal

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.12.1
1+
1.13.0

config.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ type ModuleConfig struct {
4747
anomalyDuration time.Duration
4848
anomalySize int64
4949
expectedContentTypes []string
50+
extendContentTypes bool
5051
debug bool
5152
rawHeaderExtractor RawHeaderExtractorFunc
5253
inspector Inspector
@@ -278,6 +279,15 @@ func ExpectedContentType(s string) ModuleConfigOption {
278279
}
279280
}
280281

282+
// ExtendContentTypes is a function argument to indicate that send request body
283+
// of any content-type to the agent for inspection
284+
func ExtendContentTypes(v bool) ModuleConfigOption {
285+
return func(c *ModuleConfig) error {
286+
c.extendContentTypes = v
287+
return nil
288+
}
289+
}
290+
281291
// CustomInspector is a function argument that sets a custom inspector,
282292
// an optional inspector initializer to decide if inspection should occur, and
283293
// an optional inspector finalizer that can perform any post-inspection steps

module.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,10 @@ func shouldReadBody(req *http.Request, m *Module) bool {
375375
}
376376
}
377377

378+
if m.config.extendContentTypes {
379+
return true
380+
}
381+
378382
// only read certain types of content
379383
if inspectableContentType(req.Header.Get("Content-Type")) {
380384
return true

version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
package sigsci
22

3-
const version = "1.12.1"
3+
const version = "1.13.0"

0 commit comments

Comments
 (0)