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

"SyntaxError: Unexpected end of JSON input" on wordnik API calls from Windows-based clients #6

Open
Scritches opened this issue Mar 30, 2018 · 0 comments

Comments

@Scritches
Copy link

I've been banging my head against the wall for a couple days trying to figure out why Wordnik's API server was returning an empty body for all my API calls on my development box, while it was working fine on our production server, when I finally discovered the problem.

On Windows, path.join uses '\' as the path segment separator character. On Linux, it uses '/' instead. And apparently, Wordnik's API server doesn't understand that these two separator characters are equivalent, so for Windows clients it returns an empty body - resulting in the error message in the title of this issue.

The fix is to add the following after line 123 in wordnik.js:

route = route.replace(new RegExp(/\\/,'g'), '/');

Hope this helps anyone else experiencing similar trouble with this module.

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

1 participant