sync-request
sync-request copied to clipboard
Error thrown when changing HTTP method to HEAD instead of GET
I'm writing a utility which validates response headers on an array of URLs. So I don't need to download the resource, just the headers but when issuing a HEAD request to achive this an error is reported.
To reproduce, modify the example to use HEAD and to write the response headers to the console rather than the response body:
var request = require('sync-request');
var res = request('HEAD', 'http://example.com');
console.log(res.headers);
I get:
/home/mark/sync-request/node_modules/sync-rpc/lib/index.js:167 throw error; ^
Error: unexpected end of file at extractValue (/home/mark/sync-request/node_modules/sync-rpc/lib/index.js:165:19) at /home/mark/sync-request/node_modules/sync-rpc/lib/index.js:175:12 at request (/home/mark/sync-request/node_modules/sync-request/lib/index.js:28:15) at Object.
(/home/mark/sync-request/index.js:2:11) at Module._compile (internal/modules/cjs/loader.js:816:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10) at Module.load (internal/modules/cjs/loader.js:685:32) at Function.Module._load (internal/modules/cjs/loader.js:620:12) at Function.Module.runMain (internal/modules/cjs/loader.js:877:12) at internal/main/run_main_module.js:21:11
+1
+2