About
Request is a great HTTP client for NodeJS, but if you deal only with JSON, things could be more straightforward. This lib aims to simplify Request usage for JSON only requests.
Install
Add it to your package.json file or run in your project folder:
npm install request-json --save
Build status
How it works
request = ;var client = request; var data = title: 'my title' content: 'my content';client; client; data = title: 'my new title';client; client; data = title: 'my patched title';client;
Note: Previously you should call newClient()
but now it is renamed to createClient()
.
You still can use newClient()
though it will throw deprecation message.
Extra: files
data = name: "test";client; client;
sendFile
can support file path, stream, array of file path and array of
streams. Each file is stored with the key 'file + index' (file0, file1,
file2...) in the request in case of array. For a single value, it is stored in
the field with key 'file'.
If you use a stream, it must have a "path" attribute containing its path or filename.
Extra: basic authentication
client;client;
Extra: headers manipulation
clientheaders'Cookie' = 'Your cookie';
Extra: promises
client console; });
Who uses it
request-json and request-json-light are downloaded more than 50 000 times each month. Here are the companies which use it for their API clients:
- Cozy Cloud Personal Cloud Solutions
- LeanKit Team Collaboration Solutions
- Forecast Weather Forecasting
- JS Report Reporting Platform
- Clearhead Digital Optimization Agency