Commit graph

6 commits

Author SHA1 Message Date
Brian C. Lane
46c3bed153 client: Use http.Client instead of a string for the socket
This converts the client and weldrcheck functions to use http.Client for
connections instead of passing around the socket path and opening it for
each test.
2020-03-09 18:02:54 +01:00
Ondřej Budai
284e9b9e53 fix linter errors
#261 was created before the introduction of the linter, therefore it wasn't
approved by it. This commit fixes all the introduced linter violations.
2020-03-03 14:26:13 +01:00
Brian C. Lane
9dafb3337b Refactor error handling in the client code
client errors are now returned as an 'error', API errors as APIResponse.
2020-03-03 12:21:40 +01:00
Brian C. Lane
ea1b633d3a Add exported response structures for API results
Currently the responses are all embedded in the weldr API functions.
They need to be usable by the client helper functions so I'm copying
them here and giving them names.

A later commit will go through the API can refactor it to use these
instead of the embedded ones.
2020-03-03 12:21:40 +01:00
Brian C. Lane
f0ddb3d866 client: Add tests for the core client functions 2020-03-03 12:21:40 +01:00
Brian C. Lane
cfa4233db5 client: Add client helper functions for API testing and future cli tools
This package will contain functions for communicating with the API that
can be used in both the integration tests as well as in a future cmdline
tool similar to composer-cli

When possible the client functions will return the same structures used
by weldr/api.go which have been exported in weldr/json.go
2020-03-03 12:21:40 +01:00