dispatch:url-encode-params

v1.0.0Published 10 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

dispatch:url-encode-params

A small Meteor package that rewrites URL._encodeParams from Meteor's core url package, which the core http package uses to encode the params object to the query string. This package corrects its handling of objects and arrays.

Installation

$ meteor add http dispatch:url-encode-params

Details

Without this package added, this:

1HTTP.get('http://foo.bar.com', {
2  params: {
3    filter: {
4      type: 'Foo',
5      id_eq: 15,
6    },
7    array: ['1', 'a', 'dirty[]']
8  }
9});

Will result in the following query string:

?filter=%5Bobject+Object%5D&array=1%2Ca%2Cdirty%5B%5D

When you add this package, the same call will result in the following query string:

?filter[type]=Foo&filter[id_eq]=15&array[0]=1&array[1]=a&array[2]=dirty%5B%5D