Merge pull request #8 from mDuo13/rest_apitool

[FIX] REST tool - correctly wipe req body on command select per DEV-44
This commit is contained in:
Rome Reginelli
2014-09-24 13:30:54 -07:00

View File

@@ -249,15 +249,22 @@ function select_request(request) {
//rest_url.val(command.path);
rest_url.text(command.path);
rest_method.val(command.method);
rest_method.change();
if (command.method == POST || command.method == PUT) {
//first show the request, then set its contents
rest_method.val(command.method);
rest_method.change();
cm_request.setValue(JSON.stringify(command.body, null, 2));
} else {
//No body, so wipe out the current contents.
//This prevents confusion if the user toggles the HTTP method dropdown
cm_request.setValue("");
//cm_request.setValue() doesn't work if the element is hidden,
// so wait until now to hide cm_request
rest_method.val(command.method);
rest_method.change();
}
reset_response_area();