Skip to content

Commit

Permalink
Merge pull request #158 from mackerelio/modify_DeleteGraphDef_api_url
Browse files Browse the repository at this point in the history
Modify URL path of DeleteGraphDef
  • Loading branch information
roodni committed Jun 4, 2024
2 parents f193f02 + c32ceb6 commit 5094607
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ module github.com/mackerelio/mackerel-client-go
go 1.18

require github.com/kylelemons/godebug v1.1.0

retract v0.33.0 // API endpoint for DeleteGraphDef has changed.
2 changes: 1 addition & 1 deletion graph_defs.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ func (c *Client) CreateGraphDefs(graphDefs []*GraphDefsParam) error {

// DeleteGraphDef deletes a graph definition.
func (c *Client) DeleteGraphDef(name string) error {
_, err := requestJSON[any](c, http.MethodDelete, "/api/v0/graph-defs/delete", map[string]string{"name": name})
_, err := requestJSON[any](c, http.MethodDelete, "/api/v0/graph-defs", map[string]string{"name": name})
return err
}
4 changes: 2 additions & 2 deletions graph_defs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ func TestGraphDefsOmitJSON(t *testing.T) {

func TestDeleteGraphDef(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
if req.URL.Path != "/api/v0/graph-defs/delete" {
t.Error("request URL should be /api/v0/graph-defs/delete but:", req.URL.Path)
if req.URL.Path != "/api/v0/graph-defs" {
t.Error("request URL should be /api/v0/graph-defs but:", req.URL.Path)
}

if req.Method != "DELETE" {
Expand Down

0 comments on commit 5094607

Please sign in to comment.