Openstatus www.openstatus.dev

๐Ÿš‘ assertion header

+2 -5
+1 -2
apps/checker/cmd/main.go
··· 115 115 116 116 } 117 117 switch assert.AssertionType { 118 - case request.AssertionHeaders: 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 - 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 - fmt.Println(s) 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 - AssertionHeaders AssertionType = "headers" 8 + AssertionHeader AssertionType = "header" 9 9 AssertionTextBody AssertionType = "textBody" 10 10 AssertionStatus AssertionType = "status" 11 11 AssertionJsonBody AssertionType = "jsonBody"