1.1.7 • Published 8 years ago

boxfishcurl v1.1.7

Weekly downloads
3
License
ISC
Repository
github
Last release
8 years ago

BoxfishCurl.js

Installation

npm install boxfishcurl

Using simple Request

###Usage

// GET
curl.get('http://google.com').then([Function], [Function]);
// POST
curl.post('http://your-post-url', params).then([Function], [Function]);
// PUT
curl.put('http://your-PUT-url', params).then([Function], [Function]);
// DELETE
curl.delete('http://your-DELETE-url', params).then([Function], [Function]);

default properties

you can set any request options here, including any header you may need.

curl.init({ headers: { 'Content-Type' : 'application/json' } });

Using HTTP and HTTPS modules

###Usage | Param | type | Required | Default | | ------------- |-----:| --------------:|-----:| | host | string | true | - | | path | string | true | - | | port | string | | 80 | | method | string | | 'GET'| | headers | object | | - | data | string | | 'application/x-www-form-urlencoded'

curl
	.req({
    host    : 'boxfish.com',
    path    : '/',
    headers : { 'Content-Type': 'application/json' },
    method  : 'POST',
    data    : {
        field       : 'this can be any JSON',
        used        : 'this will be sent in the request body',
        required    : false
    }
  }).then(function(response) {
    // you got your data back
  }, function(err) {
    // something went wrong
  });

Run test

npm test
1.1.7

8 years ago

1.1.6

8 years ago

1.1.5

8 years ago

1.1.4

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.0

9 years ago

1.0.9

9 years ago

1.0.8

9 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago