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

AzureFuncDemo - EnableQuery (AllowedQueryOptions) does not work as expected #60

Open
vinayakmoh opened this issue Sep 5, 2023 · 3 comments

Comments

@vinayakmoh
Copy link

vinayakmoh commented Sep 5, 2023

@xuzhg I am extending EnableQuery attribute to allow only selects and disallow everything else. But, the example (http://localhost:7071/api/v1/cn/customers?$select=name,Id&$filter=Id lt 4&$top=2&$count=true), still returns output. Am I, Missing something ?

[EnableQuery (AllowedQueryOptions = AllowedQueryOptions.Select)]

@xuzhg
Copy link
Owner

xuzhg commented Sep 5, 2023

@vinayakmoh Hi, Thanks for your issue.
Would you please let me know what response you want to get? Exceptions? or other behavior?

@xuzhg
Copy link
Owner

xuzhg commented Sep 5, 2023

@vinayakmoh By the way, I am not sure whether 'EnableQueryAttribute' works for query since I have the query codes by myself at: https://github.com/xuzhg/WebApiSample/blob/main/AzureFuncDemo/AzureFuncDemo/HttpExample.cs#L100C24-L100C92

So, Would you please change the settings in 'ODataQuerySettings" to retry?

@vinayakmoh
Copy link
Author

@vinayakmoh Hi, Thanks for your issue. Would you please let me know what response you want to get? Exceptions? or other behavior?

Yes, I was expecting an OData Exception like this

{
    "error": {
        "code": "",
        "message": "The query specified in the URI is not valid. Query option 'Select' is not allowed. To allow it, set the 'AllowedQueryOptions' property on EnableQueryAttribute or QueryValidationSettings.",
        "details": [],
        "innererror": {}
    }
}

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