Closed MartinMa closed 10 years ago
Ok I found a quick fix. Open grunt-curl\tasks\curl.js
and replace line 140 at the bottom with this:
request.get({'url': url, 'encoding': 'binary', 'proxy': 'http://127.0.0.1:3128/'}, function (err, res, body) {
whereas http://127.0.0.1:3128/
is the proxy address.
One can think about adding an option to grunt-curl which passes the proxy url through to the request function. Another possibility would be to set request.defaults once. I'm very new to grunt, I don't know what's best to handle this stuff.
grunt-curl
passes through src
directly to request
. You should be fine with
curl: {
'my-task': {
src: {
url: 'http://google.com',
proxy: 'http://127.0.0.1:3128/'
},
dest: 'google.html'
}
}
Thanks for the hint!
Thanks for the great tool, is it possible to update the documenation on https://www.npmjs.org/package/grunt-curl for this great feature please? It is a rescue for those behind the corporate firewall
Technically this is documented via
Both tasks support accepting request parameters as a src file. Here is an example creating a POST request.
but we can add an example to highlight this specific case. I will add it by the end of this weekend.
@cg-zeno-yu I have added an example of using a proxy
to the README. Released in 2.0.3
Thanks! Appreciate your work, it is amazing
:+1:
Is it possible to have grunt-curl use a proxy server?
If not, where can I start for a quick fix / hack to make it work?