Skip to content

Commit

Permalink
Removed the old 'load request' functionality. For #26.
Browse files Browse the repository at this point in the history
  • Loading branch information
gear54rus committed May 23, 2016
1 parent 11289e2 commit 3e12194
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 42 deletions.
40 changes: 0 additions & 40 deletions src/content/js/restclient.main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1353,46 +1353,6 @@ restclient.main = {
$('#request-button').click();
$('#alertUnOverrideMimeType').alert('close');
},
loadRequest: function () {
var nsIFilePicker = Components.interfaces.nsIFilePicker,
fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
fp.init(window, "Please select a exported text file to load", nsIFilePicker.modeOpen);
fp.appendFilter("Plain text","*.txt");
var res = fp.show();
if (res == nsIFilePicker.returnOK) {
restclient.NetUtil.asyncFetch(fp.file, function (inputStream, status) {
if (!Components.isSuccessCode(status)) {
alert('Failed to open this request file.');
return;
}

var data = restclient.NetUtil.readInputStreamToString(inputStream, inputStream.available());

var utf8Converter = Components.classes["@mozilla.org/intl/utf8converterservice;1"].
getService(Components.interfaces.nsIUTF8ConverterService);
var request = utf8Converter.convertURISpecToUTF8(data, "UTF-8");
try{
if (request == '') {
alert('This is an empty file.');
return;
}
request = JSON.parse(request);
request.method = (request.requestMethod) ? request.requestMethod : 'GET';
request.url = (request.requestUrl) ? request.requestUrl : false;
request.body = (request.requestBody) ? request.requestBody : false;
var headers = (request.headers && typeof request.headers == 'object')
? request.headers : false;
request.headers = [];
if (headers)
for(var i=0; i < headers.length; i++)
{
request.headers.push([headers[i], headers[++i]]);
}
restclient.main.applyRequest(request);
}catch(e) { alert('Cannot load this request.'); }
});
}
},
importFavoriteRequests: function () {
var nsIFilePicker = Components.interfaces.nsIFilePicker,
fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
Expand Down
2 changes: 0 additions & 2 deletions src/content/restclient.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
<li class="nav-header">Import/Export</li>
<li><a href="#" onclick="restclient.main.importFavoriteRequests(); return false;">Import Bookmarks</a></li>
<li><a href="#" onclick="restclient.main.exportFavoriteRequests(); return false;">Export Bookmarks</a></li>
<li class="nav-header">Load (Version 1.3.x)</li>
<li><a style="cursor:pointer" onclick="restclient.main.loadRequest();return false;">Load Request</a></li>
</ul>
</li>
<li class="dropdown">
Expand Down

0 comments on commit 3e12194

Please # to comment.