POSTKARAN-REQUEST (Version : BETA-0.0.7)
Simplified node HTTP/HTTPS Requester built using native node modules.
Installation
This is a Node.js module available through the npm registry.
$ npm i postkaran-request
Usage
Include
var postKaran = ;
Simple Usage
;
Usage With Promise
postKaran;
Usage With Callback
postKaran;
Example:
;
Request
Methods
- get
- post
- delete
- put
- head
url
http(s)://example.com
contentType
- 'application/json',
- 'application/x-www-form-urlencoded',
- 'multipart/form-data',
- 'text/plain'
content
- json or json string for application/json
- query or query string for application/x-www-form-urlencoded'
- For multipart/form-data object must be sent in following manner { key1:{ value:path_to_file, type:'file' }, key2:{ value:'some value goes here', type:'text' } }
Response
- data - response data,
- cookies - response cookies,
- headers - response headers,
- statusCode - status code sent from server,
- status - status sent from server,
- viewable - says data is viewable or not,
- fileExtension - says the type of data is return for 'text/html' fileExtension-'html'