Skip to content
Permalink
Browse files

fix(http): Change header -> headers to be more consistent (BREAKING C…

…HANGE) (#528)
  • Loading branch information
aelsabbahy committed Dec 18, 2019
1 parent 3c6e940 commit 8aaeb027f764cc766b96d26b31abd59bf0e80f65
Showing with 7 additions and 7 deletions.
  1. +1 −1 integration-tests/goss/goss-shared.yaml
  2. +4 −4 resource/http.go
  3. +2 −2 system/http.go
@@ -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
@@ -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"`
@@ -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))
@@ -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,
@@ -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)
@@ -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
}

0 comments on commit 8aaeb02

Please sign in to comment.
You can’t perform that action at this time.