<commit_before>http-request - Simplifies nodeJS HTTP requests [![Build Status](https://secure.travis-ci.org/ranm8/http-request.png?branch=master)](http://travis-ci.org/ranm8/http-request)
==============================================

http-request is a nodeJS http client that simplifies HTTP request making.

Importent to note, this module is still under development and can be unstable!

## Installation

	npm install http_request  


## How to use?

http-request is extremely easy to use and always return a promise (using the great Q module)...

Simply require the module and start requesting:

``` javascript
var httpRequest = require('http_request'); 
```
GET Request:

``` javascript
httpRequest.get('http://example.com').then(function(response) {
	// Get the response body
	response.getBody();
});
```

POST Request in JSON:

``` javascript
httpRequest.post('http://example.com', {
		body: {
			hello: 'world'
		}
	})
	.then(function(response) {
		// Get the response body
		response.getBody();
	});
```

## API Reference

### options

#### `method {string}` 
HTTP method to use, can be one of the following methods: POST | GET | DELETE | HEAD | PUT.

#### `body {object|string}`
Can be either an object (key, val) or a string, will be formatted depending on the dataType property and served via response body.
<commit_msg>(fix) docs and removed supported methods<commit_after>http-request - Simplifies nodeJS HTTP requests [![Build Status](https://secure.travis-ci.org/ranm8/http-request.png?branch=master)](http://travis-ci.org/ranm8/http-request)
==============================================

http-request is a nodeJS http client that simplifies HTTP request making.

Importent to note, this module is still under development and can be unstable!

## Installation

	npm install http_request  


## How to use?

http-request is extremely easy to use and always return a promise (using the great Q module)...

Simply require the module and start requesting:

``` javascript
var httpRequest = require('http_request'); 
```
GET Request:

``` javascript
httpRequest.get('http://example.com').then(function(response) {
	// Get the response body
	response.getBody();
});
```

POST Request in JSON:

``` javascript
httpRequest.post('http://example.com', {
		body: {
			hello: 'world'
		}
	})
	.then(function(response) {
		// Get the response body
		response.getBody();
	});
```

## API Reference

### options

#### `method {string}` 
HTTP method to use, can be any valid HTTP method (e.g. POST, GET, DELETE, HEAD, PUT, etc.).

#### `body {object|string}`
Can be either an object (key, val) or a string, will be formatted depending on the dataType property and served via response body.

{'fraction_non_alphanumeric': 0.15936106983655274, 'fraction_numerical': 0.0014858841010401188, 'mean_word_length': 4.473577235772358, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1231752', 'n_tokens_mistral': 827, 'n_tokens_neox': 773, 'n_words': 276}