weldr: update our use of BurntSushi/toml
The old method is deprecated and failing the linter. Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
parent
32f3d3d66e
commit
a3c207945f
2 changed files with 4 additions and 4 deletions
|
|
@ -1902,7 +1902,7 @@ func (api *API) blueprintsNewHandler(writer http.ResponseWriter, request *http.R
|
|||
if contentType[0] == "application/json" {
|
||||
err = json.NewDecoder(request.Body).Decode(&blueprint)
|
||||
} else if contentType[0] == "text/x-toml" {
|
||||
_, err = toml.DecodeReader(request.Body, &blueprint)
|
||||
_, err = toml.NewDecoder(request.Body).Decode(&blueprint)
|
||||
} else {
|
||||
err = errors_package.New("blueprint must be in json or toml format")
|
||||
}
|
||||
|
|
@ -1975,7 +1975,7 @@ func (api *API) blueprintsWorkspaceHandler(writer http.ResponseWriter, request *
|
|||
if contentType[0] == "application/json" {
|
||||
err = json.NewDecoder(request.Body).Decode(&blueprint)
|
||||
} else if contentType[0] == "text/x-toml" {
|
||||
_, err = toml.DecodeReader(request.Body, &blueprint)
|
||||
_, err = toml.NewDecoder(request.Body).Decode(&blueprint)
|
||||
} else {
|
||||
err = errors_package.New("blueprint must be in json or toml format")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -326,7 +326,7 @@ func TestBlueprintsInfoToml(t *testing.T) {
|
|||
require.Equal(t, http.StatusOK, resp.StatusCode)
|
||||
|
||||
var got blueprint.Blueprint
|
||||
_, err := toml.DecodeReader(resp.Body, &got)
|
||||
_, err := toml.NewDecoder(resp.Body).Decode(&got)
|
||||
require.NoErrorf(t, err, "error decoding toml file")
|
||||
|
||||
expected := blueprint.Blueprint{
|
||||
|
|
@ -1381,7 +1381,7 @@ func TestSourcesInfoToml(t *testing.T) {
|
|||
resp := recorder.Result()
|
||||
|
||||
var sources map[string]store.SourceConfig
|
||||
_, err := toml.DecodeReader(resp.Body, &sources)
|
||||
_, err := toml.NewDecoder(resp.Body).Decode(&sources)
|
||||
require.NoErrorf(t, err, "error decoding toml file")
|
||||
|
||||
expected := map[string]store.SourceConfig{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue