Skip to content

Commit

Permalink
Fix empty request body
Browse files Browse the repository at this point in the history
  • Loading branch information
danischm committed Oct 7, 2021
1 parent 5c80343 commit aec33e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.1

- FIX: Render valid request body for resource without content

## 0.1.0

- Initial release
1 change: 1 addition & 0 deletions internal/provider/utils_rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ func prepareBody(d *schema.ResourceData) (nxos.Body, error) {
content := d.Get("content")
contentStrMap := toStrMap(content.(map[string]interface{}))

body.Str = fmt.Sprintf("{\"%s\":{\"attributes\":{}}}", className)
for attr, value := range contentStrMap {
body = body.Set(fmt.Sprintf("%s.attributes.%s", className, attr), value)
}
Expand Down

0 comments on commit aec33e4

Please sign in to comment.