Skip to content

Lucbug/meteor-http-extras

Repository files navigation

IMPORTANT: This package is no longer maintained. Now that Meteor apps can use NPM packages directly, I recommend using a more standards-based package such as isomorphic-fetch rather than Meteor's HTTP package.

http-extras

Adds the features proposed in this PR. Add this to your project along with the core http package.

Installation

In a Meteor app directory, enter:

$ meteor add http lucbug:http

Details

The API methods are the same as in the core HTTP package.

This package adds a responseType option to HTTP.call on both the client and the server. It also adds an encoding option on the server.

The responseType option can be one of the following string values:

  • "string": result.content will be a String (this is the default and matches the current behavior)
  • "blob": (Client only) result.content will be a Blob
  • "document": (Client only) result.content will be a Document
  • "buffer": (Server only) result.content will be a Buffer (setting encoding to null does the same thing)
  • "arraybuffer": result.content will be an ArrayBuffer
  • "ejson-binary": result.content will be an EJSON.binary
  • "json": result.content will be an Object

On the server only, you may additionally specify the desired encoding with the encoding option when responseType is "string". This takes string values matching those from Node's Buffer.toString method.

License Note

The LICENSE covers my additions and changes. Much of the code is copied from Meteor's core http package.

About

Modified package from aldeed:http. Improves the core HTTP package

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published