0.1.2 • Published 10 years ago

gracenode-request v0.1.2

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

Request Module


Access

Configurations N/A

.GET(url string, requestParams object, options object*, callback function)

Sends a GET request

Options

{
	// send extra headers
	headers: <object>,
	// set specific encoding
	encoding: <string>,
	// unzip the response body
	gzip: <boolean>
}

Example:

gracenode.request.GET('http://xxxx.com/aaa/bbb', { test: 1 }, null, function (error, body, status) {
	// do something
});

.POST(url string, requestParams object, options object*, callback function)

Sends a POST request

Options

{
	// send extra headers
	headers: <object>,
	// set specific encoding
	encoding: <string>,
	// unzip the response body
	gzip: <boolean>
}

Example:

gracenode.request.POST('http://xxxx.com/aaa/bbb', { test: 1 }, null, function (error, body, status) {
	// do something
});

.PUT(url string, requestParams object, options object*, callback function)

Sends a PUT request

Options

{
	// send extra headers
	headers: <object>,
	// set specific encoding
	encoding: <string>,
	// unzip the response body
	gzip: <boolean>
}

Example:

gracenode.request.PUT('http://xxxx.com/aaa/bbb', { test: 1 }, null, function (error, body, status) {
	// do something
});

.DELETE(url string, requestParams object, options object*, callback function)

Sends a DELETE request

Options

{
	// send extra headers
	headers: <object>,
	// set specific encoding
	encoding: <string>,
	// unzip the response body
	gzip: <boolean>
}

Example:

gracenode.request.DELETE('http://xxxx.com/aaa/bbb', { test: 1 }, null, function (error, body, status) {
	// do something
});