Skip to content

Commit

Permalink
Send response in JSON format
Browse files Browse the repository at this point in the history
  • Loading branch information
sumukhatv committed Dec 15, 2021
1 parent 0e254bd commit f2a7b1c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go-server-server/go/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ func ConfigVrouterVrfIdPost(w http.ResponseWriter, r *http.Request) {
guid := CacheGetVniId(uint32(attr.Vnid))
if guid != "" {
WriteRequestErrorWithSubCode(w, http.StatusConflict, RESRC_EXISTS,
"Object already exists: vni=" + strconv.Itoa(attr.Vnid) + " vnet_name=" + guid, []string{}, "")
"Object already exists {\"vni\":\"" + strconv.Itoa(attr.Vnid) + "\", \"vnet_name\":\"" + guid +"\"}", []string{}, "")
return
}

Expand Down
2 changes: 1 addition & 1 deletion test/test_restapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def test_post_vrouter_duplicate(self, setup_restapi_client):
'vnid': 1001
})
assert r.status_code == 409
assert r.json()['error']['message'] == "Object already exists: vni=1001 vnet_name=vnet-guid-1"
assert r.json()['error']['message'] == "Object already exists {\"vni\":\"1001\", \"vnet_name\":\"vnet-guid-1\"}"

def test_post_vrouter_default(self, setup_restapi_client):
_, _, configdb, restapi_client = setup_restapi_client
Expand Down

0 comments on commit f2a7b1c

Please sign in to comment.