Skip to content

Commit

Permalink
fix(http): Change header -> headers to be more consistent (BREAKING C…
Browse files Browse the repository at this point in the history
…HANGE) (#528)
  • Loading branch information
aelsabbahy authored Dec 18, 2019
1 parent 3c6e940 commit 8aaeb02
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion integration-tests/goss/goss-shared.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ http:
timeout: 5000
request-headers:
- "Foo: bar"
header: ["Content-Type: application/json"]
headers: ["Content-Type: application/json"]
body: ['"Foo": "bar"']
https://httpbin.org/basic-auth/username/secret:
status: 200
Expand Down
8 changes: 4 additions & 4 deletions resource/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type HTTP struct {
NoFollowRedirects bool `json:"no-follow-redirects" yaml:"no-follow-redirects"`
Timeout int `json:"timeout" yaml:"timeout"`
RequestHeader []string `json:"request-headers,omitempty" yaml:"request-headers,omitempty"`
Header []string `json:"header,omitempty" yaml:"header,omitempty"`
Headers []string `json:"headers,omitempty" yaml:"headers,omitempty"`
Body []string `json:"body" yaml:"body"`
Username string `json:"username,omitempty" yaml:"username,omitempty"`
Password string `json:"password,omitempty" yaml:"password,omitempty"`
Expand Down Expand Up @@ -49,8 +49,8 @@ func (u *HTTP) Validate(sys *system.System) []TestResult {
if shouldSkip(results) {
skip = true
}
if len(u.Header) > 0 {
results = append(results, ValidateContains(u, "Header", u.Header, sysHTTP.Header, skip))
if len(u.Headers) > 0 {
results = append(results, ValidateContains(u, "Headers", u.Headers, sysHTTP.Headers, skip))
}
if len(u.Body) > 0 {
results = append(results, ValidateContains(u, "Body", u.Body, sysHTTP.Body, skip))
Expand All @@ -66,7 +66,7 @@ func NewHTTP(sysHTTP system.HTTP, config util.Config) (*HTTP, error) {
HTTP: http,
Status: status,
RequestHeader: []string{},
Header: []string{},
Headers: []string{},
Body: []string{},
AllowInsecure: config.AllowInsecure,
NoFollowRedirects: config.NoFollowRedirects,
Expand Down
4 changes: 2 additions & 2 deletions system/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
type HTTP interface {
HTTP() string
Status() (int, error)
Header() (io.Reader, error)
Headers() (io.Reader, error)
Body() (io.Reader, error)
Exists() (bool, error)
SetAllowInsecure(bool)
Expand Down Expand Up @@ -124,7 +124,7 @@ func (u *DefHTTP) Status() (int, error) {
return u.resp.StatusCode, nil
}

func (u *DefHTTP) Header() (io.Reader, error) {
func (u *DefHTTP) Headers() (io.Reader, error) {
if err := u.setup(); err != nil {
return nil, err
}
Expand Down

0 comments on commit 8aaeb02

Please sign in to comment.