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

option to add custom query params #120

Open
sg2707 opened this issue Feb 20, 2024 · 1 comment
Open

option to add custom query params #120

sg2707 opened this issue Feb 20, 2024 · 1 comment

Comments

@sg2707
Copy link

sg2707 commented Feb 20, 2024

If the endpoint accepts additional query parameters other than oData queryparams, we have to append them after the buildQuery manually. To avoid this can we create a collection of custom parameter object that will be appended to the query?

Eg: myendpoint?oDataParam=xyz&customparam=1

@lenardchristopher
Copy link
Collaborator

@sg2707 why wouldn't you handle that outside of this package? That's what I do.

A simple example:

const odataParamsString: string = buildQuery({ select: ['foo', 'bar']});
const customParms: string = ['hello=world', 'x=y'].join('&');

const requestUrl: string = `https://foobar.com?${odataParamsString}&${customParms}`;

Overall, I don't think you, as a developer, want your custom query params dependent on an OData package. The best design is to keep them separated.

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