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

Exception while using special characters in expression value #15

Open
vijendrasainimetacube opened this issue May 15, 2020 · 2 comments

Comments

@vijendrasainimetacube
Copy link

Hi,
I am getting exception while using '/' in expression value. for example:

var query = createQuery("$filter=status ne 'FIXED/RESOLVED'");

Error: Unexpected character at 14$filter=status ne 'FIXED/RESOLVED'
at D:\workspace\AmeriGas\API-Server\api-server\node_modules\odata-v4-parser\lib\parser.js:25:19
at Object.query (D:\workspace\AmeriGas\API-Server\api-server\node_modules\odata-v4-parser\lib\parser.js:45:93)
at createQuery (D:\workspace\AmeriGas\API-Server\api-server\node_modules\odata-v4-mongodb\lib\index.js:6:66)

Thanks

@MathieuCouette
Copy link

It's somewhat complicated, but my understanding is that the module expects the parameter names ($filter, in this case) and the parameter values (status ne 'FIXED/RESOLVED', in this case) to be URI encoded. You can use encodeURIComponent function to do that.

Keep in mind that the module currently has a bug that prevents the usage of URI encoded date times.

@WandererInVoids
Copy link

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

3 participants