fix lint errors
This commit is contained in:
parent
11a55e27d0
commit
adea95972d
@ -29,14 +29,14 @@ func HTTPFactory(u *url.URL) Resource {
|
||||
|
||||
type HTTPHeader struct {
|
||||
Name string `yaml:"name" json:"name"`
|
||||
Value string `yaml:"value" json"value"`
|
||||
Value string `yaml:"value" json:"value"`
|
||||
}
|
||||
|
||||
// Manage the state of an HTTP endpoint
|
||||
type HTTP struct {
|
||||
client *http.Client `yaml:"-" json:"-"`
|
||||
Endpoint string `yaml:"endpoint" json:"endpoint"`
|
||||
Headers []HTTPHeader `yaml:"headers,omitempty", json:"headers,omitempty"`
|
||||
Headers []HTTPHeader `yaml:"headers,omitempty" json:"headers,omitempty"`
|
||||
Body string `yaml:"body,omitempty" json:"body,omitempty"`
|
||||
State string `yaml:"state" json:"state"`
|
||||
}
|
||||
@ -107,10 +107,10 @@ func (h *HTTP) Create() error {
|
||||
req.Header.Add(header.Name, header.Value)
|
||||
}
|
||||
resp, err := h.client.Do(req)
|
||||
defer resp.Body.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -44,12 +44,14 @@ func TestHTTPRead(t *testing.T) {
|
||||
|
||||
server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
|
||||
assert.Equal(t, req.URL.String(), "/resource/user/foo")
|
||||
rw.Write([]byte(`
|
||||
n,e := rw.Write([]byte(`
|
||||
type: "user"
|
||||
attributes:
|
||||
name: "foo"
|
||||
gecos: "foo user"
|
||||
`))
|
||||
assert.Nil(t, e)
|
||||
assert.Greater(t, n, 0)
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user