Skip to content

Commit

Permalink
moves bools to pointers, adds AutocompleteHeaders
Browse files Browse the repository at this point in the history
  • Loading branch information
M4tteoP committed Nov 11, 2023
1 parent da43d43 commit a75ee3b
Showing 1 changed file with 27 additions and 14 deletions.
41 changes: 27 additions & 14 deletions types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ func intPtr(i int) *int {
return &i
}

func boolPtr(b bool) *bool {
return &b
}

func strPtr(s string) *string {
return &s
}
Expand All @@ -29,17 +33,18 @@ var (
"Accept": "*/*",
}
exampleInput = Input{
DestAddr: strPtr("192.168.0.1"),
Port: intPtr(8080),
Protocol: strPtr("http"),
URI: strPtr("/test"),
Version: strPtr("HTTP/1.1"),
Headers: exampleHeaders,
Method: strPtr("REPORT"),
Data: nil,
EncodedRequest: "TXkgRGF0YQo=",
SaveCookie: false,
StopMagic: false,
DestAddr: strPtr("192.168.0.1"),
Port: intPtr(8080),
Protocol: strPtr("http"),
URI: strPtr("/test"),
Version: strPtr("HTTP/1.1"),
Headers: exampleHeaders,
Method: strPtr("REPORT"),
Data: nil,
EncodedRequest: "TXkgRGF0YQo=",
SaveCookie: boolPtr(false),
StopMagic: boolPtr(true),
AutocompleteHeaders: boolPtr(false),
}
exampleOutput = Output{
Status: []int{200},
Expand Down Expand Up @@ -230,14 +235,22 @@ type Input struct {
// examples:
// - name: SaveCookie
// value: 80
SaveCookie bool `yaml:"save_cookie,omitempty" koanf:"save_cookie,omitempty"`
SaveCookie *bool `yaml:"save_cookie,omitempty" koanf:"save_cookie,omitempty"`

// description: |
// StopMagic is deprecated.
// examples:
// - name: StopMagic
// value: false
StopMagic *bool `yaml:"stop_magic" koanf:"stop_magic,omitempty"`

// description: |
// StopMagic allows you to declare which port on the destination host the tests should connect to.
// AutocompleteHeaders allows the test framework to automatically fill the request with Content-Type and Connection headers.
// Defaults to true.
// examples:
// - name: StopMagic
// value: false
StopMagic bool `yaml:"stop_magic" koanf:"stop_magic,omitempty"`
AutocompleteHeaders *bool `yaml:"autocomplete_headers" koanf:"autocomplete_headers,omitempty"`

// description: |
// EncodedRequest allows you to declare which port on the destination host the tests should connect to.
Expand Down

0 comments on commit a75ee3b

Please sign in to comment.