Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current restivus build causes crash on "Restivus.configure" #1

Closed
Tolmark12 opened this issue Jan 27, 2015 · 3 comments
Closed

Current restivus build causes crash on "Restivus.configure" #1

Tolmark12 opened this issue Jan 27, 2015 · 3 comments

Comments

@Tolmark12
Copy link

Looks like this line causes meteor to crash when calling Restivus.configure() and config.apiPath isn't defined.

Can be fixed by adding existence checks :

  if config.apiPath?[0] is '/'
    config.apiPath = config.apiPath.slice 1
  if config.apiPath?[-1] isnt '/'
    config.apiPath = config.apiPath + '/'
@Tolmark12 Tolmark12 changed the title Current Build Crashes on "Restivus.configure" Current restivus build causes crash on "Restivus.configure" Jan 27, 2015
@kahmali
Copy link
Owner

kahmali commented Jan 28, 2015

Good catch! Sorry about that. Your suggestion would fix the error, but the intended behavior is that the default apiPath ('api/') be used in that case. To fix that, I needed to copy all the properties from config to this.config (for some crazy reason I was doing that immediately after trying to normalize the base api path instead of before, where it belonged), and then use this.config.apiPath instead of config.apiPath during the normalization. Again, sorry if that caused you any headache. I'll have the fix pushed and published very soon. I'll let you know once it's all set.

@Tolmark12
Copy link
Author

Sweet, thanks!

btw, Great work on Restivus, just what I needed.

kahmali added a commit that referenced this issue Jan 28, 2015
The default api path ('api/') is now used if no apiPath is provided in
Restivus.configure().

A separate issue was also discovered and resolved in Restivus.configure()
where an apiPath ending with '/' was having an extra '/' appended to it.
Fix so it only happens when the path is missing the trailing '/'.
@kahmali
Copy link
Owner

kahmali commented Jan 28, 2015

Just published v0.5.4 with the fix. You should be able to grab it with > meteor update restivus. Thanks again for reporting it! And thanks for the compliment! It makes me warm and fuzzy inside that Restivus has been helpful to you. This is my first project that anyone besides myself has actually used, so this is all very awesome for me.

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

No branches or pull requests

2 participants