{ "name": "grunt-http", "description": "Sends a HTTP request and deals with the response.", "version": "1.1.0", "homepage": "https://github.com/johngeorgewright/grunt-http", "author": { "name": "John Wright", "email": "johngeorge.wright@gmail.com" }, "repository": { "type": "git", "url": "git://github.com/johngeorgewright/grunt-http.git" }, "bugs": { "url": "https://github.com/johngeorgewright/grunt-http/issues" }, "licenses": [ { "type": "MIT", "url": "https://github.com/johngeorgewright/grunt-http/blob/master/LICENSE-MIT" } ], "main": "Gruntfile.js", "engines": { "node": ">= 0.8.0" }, "scripts": { "test": "grunt test" }, "devDependencies": { "grunt-contrib-jshint": "~0.1.1", "grunt-contrib-clean": "~0.4.0", "grunt-contrib-nodeunit": "~0.1.2", "grunt": "~0.4.1", "sinon": "~1.7.2" }, "peerDependencies": { "grunt": "~0.4.1" }, "keywords": [ "gruntplugin", "request", "http" ], "dependencies": { "request": "~2.33.0" }, "readme": "# grunt-http\n\n> Sends a HTTP request and deals with the response.\n\n[![NPM](https://nodei.co/npm/grunt-http.png)](https://nodei.co/npm/grunt-http)\n\n## Getting Started\nThis plugin requires Grunt `~0.4.1`\n\nIf you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:\n\n```shell\nnpm install grunt-http --save-dev\n```\n\nOnce the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:\n\n```js\ngrunt.loadNpmTasks('grunt-http');\n```\n\n## The \"http\" task\n\n### Overview\nIn your project's Gruntfile, add a section named `http` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n http: {\n your_service: {\n options: {\n url: 'your/url.com',\n },\n dest: 'optional/file/to/save/response'\n }\n }\n})\n```\n\nIf you add a source file, the contents will be added to the `body` option unless another field is specified in the `sourceField` option.\n\n### Options\n\ngrunt-http uses the [request](https://github.com/mikeal/request) module under the hood, and apart from a couple specific to grunt-http options, the rest get passed straight to it. Here's a copy of the of the module's option docs. Otherwise, [go to the repo](https://github.com/mikeal/request) and have a look at what's it's capable of.\n\n- `uri || url` - fully qualified uri or a parsed url object from url.parse(). REQUIRED.\n- `qs` - object containing querystring values to be appended to the uri\n- `method` - http method, defaults to GET\n- `headers` - http headers, defaults to {}\n- `body` - entity body for PATCH, POST and PUT requests. Must be buffer or string.\n- `sourceField` - A field in the body or form to add the source files' contents to. Can contain full stops to separate object path. Ie \"form.js\\_code\".\n- `form` - when passed an object this will set body but to a querystring representation of value and adds Content-type: application/x-www-form-urlencoded; charset=utf-8 header. When passed no option a FormData instance is returned that will be piped to request.\n- `auth` - A hash containing values user || username, password || pass, and sendImmediately (optional). [See more info here](https://github.com/mikeal/request#http-authentication).\n- `json` - sets body but to JSON representation of value and adds Content-type: application/json header. Additionally, parses the response body as json.\n- `multipart` - (experimental) array of objects which contains their own headers and body attribute. Sends multipart/related request. See example below.\n- `followRedirect` - follow HTTP 3xx responses as redirects. defaults to true.\n- `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects. defaults to false.\n- `maxRedirects` - the maximum number of redirects to follow, defaults to 10.\n- `encoding` - Encoding to be used on setEncoding of response data. If set to null, the body is returned as a Buffer.\n- `pool` - A hash object containing the agents for these requests. If omitted this request will use the global pool which is set to node's default maxSockets.\n- `pool.maxSockets` - Integer containing the maximum amount of sockets in the pool.\n- `timeout` - Integer containing the number of milliseconds to wait for a request to respond before aborting the request\n- `proxy` - An HTTP proxy to be used. Support proxy Auth with Basic Auth the same way it's supported with the url parameter by embedding the auth info in the uri.\n- `oauth` - Options for OAuth HMAC-SHA1 signing. [See more info here](https://github.com/mikeal/request#oauth-signing).\n- `hawk` - Options for [Hawk signing](https://github.com/hueniverse/hawk). The credentials key must contain the necessary signing info, [see hawk docs for details](https://github.com/hueniverse/hawk#usage-example).\n- `strictSSL` - Set to true to require that SSL certificates be valid. Note: to use your own certificate authority, you need to specify an agent that was created with that ca as an option.\n- `jar` - Set to false if you don't want cookies to be remembered for future use or define your custom cookie jar ([see mikeal/request's examples section](https://github.com/mikeal/request#examples))\n- `aws` - object containing aws signing information, should have the properties key and secret as well as bucket unless you're specifying your bucket as part of the path, or you are making a request that doesn't use a bucket (i.e. GET Services)\n- `httpSignature` - Options for the [HTTP Signature Scheme](https://github.com/joyent/node-http-signature/blob/master/http_signing.md) using [Joyent's library](https://github.com/joyent/node-http-signature). The keyId and key properties must be specified. See the docs for other options.\n- `localAddress` - Local interface to bind for network connections.\n- `ignoreErrors` - Ignore the status code returned (if any).\n\n### Usage Examples\n\n#### Google Closure\nIn this example, we're using google's closure service to compile a JS file.\n\n```js\ngrunt.initConfig({\n http: {\n closure: {\n options: {\n url: 'http://closure-compiler.appspot.com/compile',\n method: 'POST',\n form: {\n output_info: 'compiled_code',\n output_format: 'text',\n compilation_level: 'SIMPLE_OPTIMIZATIONS',\n warning_level: 'default'\n },\n sourceField: 'form.js_code'\n },\n files: {\n 'build/main.js': 'src/main.js'\n }\n }\n }\n});\n```\n\n## Contributing\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).\n\n## [Release History](/johngeorgewright/grunt-http/releases)\n\n", "readmeFilename": "README.md", "_id": "grunt-http@1.1.0", "dist": { "shasum": "469e11c742532140e45476e87fd7bf7be9fe7a54" }, "_from": "grunt-http@", "_resolved": "https://registry.npmjs.org/grunt-http/-/grunt-http-1.1.0.tgz" }