Skip to content
This repository has been archived by the owner on Oct 23, 2019. It is now read-only.

Cannot handle 'apiPath' with slashes e.g. 'api/v1' #29

Open
hellogerard opened this issue Sep 11, 2013 · 0 comments
Open

Cannot handle 'apiPath' with slashes e.g. 'api/v1' #29

hellogerard opened this issue Sep 11, 2013 · 0 comments

Comments

@hellogerard
Copy link

Hello,

Thanks for the great package. Since upgrading to Meteor 0.6.5, collection-api does not handle an API prefix with a slash, e.g. 'api/v1'. I think I've identified a couple places that need to change.

Line 63 changes from this:

      if (req.url.split('/')[1] !== self.options.apiPath) {

to something like this:

      if (req.url.slice(1, self.options.apiPath.length + 1) !== self.options.apiPath) {

And line 97 from this:

    requestPath = self._requestUrl.pathname.split('/').slice(2,4);

to something like this:

    var apiParts = self._server.options.apiPath.split('/').length + 1;
    requestPath = self._requestUrl.pathname.split('/').slice(apiParts, apiParts + 2);

Feel free to improve upon the code.

Cheers!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant