tangled
alpha
login
or
join now
openstatus.dev
/
openstatus
5
fork
atom
Openstatus
www.openstatus.dev
5
fork
atom
overview
issues
pulls
pipelines
๐ assertion header
Thibault Le Ouay
2 years ago
1a2abcbb
2aa276da
+2
-5
3 changed files
expand all
collapse all
unified
split
apps
checker
cmd
main.go
pkg
assertions
assertions.go
request
request.go
+1
-2
apps/checker/cmd/main.go
···
115
115
116
116
}
117
117
switch assert.AssertionType {
118
118
-
case request.AssertionHeaders:
118
118
+
case request.AssertionHeader:
119
119
var target assertions.HeaderTarget
120
120
if err := json.Unmarshal(a, &target); err != nil {
121
121
return fmt.Errorf("unable to unmarshal IntTarget: %w", err)
122
122
}
123
123
isSuccessfull = isSuccessfull && target.HeaderEvaluate(res.Headers)
124
124
125
125
-
fmt.Println("assertion type", assert.AssertionType)
126
125
case request.AssertionTextBody:
127
126
fmt.Println("assertion type", assert.AssertionType)
128
127
case request.AssertionStatus:
-2
apps/checker/pkg/assertions/assertions.go
···
61
61
62
62
func (target HeaderTarget) HeaderEvaluate(s string) bool {
63
63
64
64
-
fmt.Println(s)
65
65
-
66
64
headers := map[string]interface{}{}
67
65
68
66
if err := json.Unmarshal([]byte(s), &headers); err != nil {
+1
-1
apps/checker/request/request.go
···
5
5
type AssertionType string
6
6
7
7
const (
8
8
-
AssertionHeaders AssertionType = "headers"
8
8
+
AssertionHeader AssertionType = "header"
9
9
AssertionTextBody AssertionType = "textBody"
10
10
AssertionStatus AssertionType = "status"
11
11
AssertionJsonBody AssertionType = "jsonBody"