diepm / vim-rest-console

A REST console for Vim.
658 stars 54 forks source link

Fixed curl progress output included in responds #97

Open Aadniz opened 3 years ago

Aadniz commented 3 years ago

Without curl --silence, it causes the respond to contain the progress of the request, like the example below:

without silent

curl http://192.168.1.101:9200/ | cat

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   536  100   536    0     0   261k      0 --:--:-- --:--:-- --:--:--  261k
{
  "name" : "gallery",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "j7ij07pdSISexz53Rt7gPA",
  "version" : {
    "number" : "7.12.0",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "78722783c38caa25a70982b5b042074cde5d3b3a",
    "build_date" : "2021-03-18T06:17:15.410153305Z",
    "build_snapshot" : false,
    "lucene_version" : "8.8.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

with silent

curl --silent http://192.168.1.101:9200/ | cat

{
  "name" : "gallery",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "j7ij07pdSISexz53Rt7gPA",
  "version" : {
    "number" : "7.12.0",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "78722783c38caa25a70982b5b042074cde5d3b3a",
    "build_date" : "2021-03-18T06:17:15.410153305Z",
    "build_snapshot" : false,
    "lucene_version" : "8.8.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

Using "cat" pipe as it gives the same result as the plugin does

riccione commented 5 months ago

It is a nice idea to have, however I believe it should be implemented differently. My suggestion: create a configurable variable for it and by default it can be disabled. When the configuration variable is set - you enable it. Current implementation is straight forward and it will work for majority of users, but it lacks flexibility. In some cases it is necessary to get curl statistics.