-
-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright 2024 Juan Pablo Tosso and the OWASP Coraza contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package experimental | ||
|
||
import "github.com/corazawaf/coraza/v3/types" | ||
|
||
type Transaction interface { | ||
types.Transaction | ||
UnixTimestamp() int64 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright 2024 Juan Pablo Tosso and the OWASP Coraza contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package experimental_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/corazawaf/coraza/v3" | ||
"github.com/corazawaf/coraza/v3/experimental" | ||
) | ||
|
||
func TestTxTimestamp(t *testing.T) { | ||
waf, err := coraza.NewWAF(coraza.NewWAFConfig()) | ||
if err != nil { | ||
panic(err) | ||
} | ||
tx := waf.NewTransaction() | ||
tx2, ok := tx.(experimental.Transaction) | ||
if !ok { | ||
t.Error("Transaction does not implement experimental.Transaction") | ||
} | ||
if tx2.UnixTimestamp() == 0 { | ||
t.Error("Timestamp should not be 0") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters