-
Notifications
You must be signed in to change notification settings - Fork 178
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
Set 'filter' parameter to HTTP headers #151
Comments
Hi @jesperbruunhansen thanks for reaching out, I can take a look a it, it may not be so difficult to do it.. if tests passes I may be adding this request to the next release. cheers |
Fixed |
Hi again @jonathan-casarrubias and thanks for a swift implementation of this request! Sorry if I am missing anything, by how do I actually tell the SDK to build the urls with the |
Hi @jesperbruunhansen |
Hi @PhilippeCorreges as I understand @jonathan-casarrubias has implemented this feature in release 2.1.0-beta.11 (please correct me if I'm wrong). I've looked through the commits, but I'm not able to figure out myself how the implementation is working. |
@jesperbruunhansen |
How does your request urls look, @PhilippeCorreges? Mine still look like something:
whereas I was looking for ex:
|
seems to be implemented in 2.1.0-rc.5 ... |
@jesperbruunhansen |
but concretely this message shows the issue: |
@PhilippeCorreges okay, so your version does also parse the filter-object to the url string. I guess we'll have to wait for @jonathan-casarrubias's reply on how to use the Regarding your error you have two options:
The other option is to use |
@jesperbruunhansen here is my working where clause without parsing the url: |
What URL does this generate? Can I see the headers of your request please. |
Hey guys, thanks for reaching out... Something really strange happened in here, it seems the patch was missed while merging the build, I have reviewed the base.service and it does miss this functionality. The only thing is sending through the headers is the token, but not the filter I will need to re-open and make sure it is available by next version |
Ok now it has been published under version RC6 Enjoy. Cheers |
Again, @jonathan-casarrubias thank you very much for quick reply and implementation! Last question, will the SDK automatically set the filter to the header in RC6, or should we activate/deactivate globally somewhere? |
The sdk will automatically set the filter into the header, the query string led to a bunch of issues in the past. For now will be by default sent through the headers, but if more than 1 person complains about this approach I may add an option to decide. Not for now. lol Cheers |
Haha, great! Thanks for the help, really appreciate it :) Jesper. |
Is this working with cors? I am getting the following error that seams related to this change:
|
Ok fixed it by adding |
Hi, |
this yields #357 |
@jonathan-casarrubias I also found another use case to have a switch option. With Progresive Web Apps and specifically service workers, caching is usually done at URL level. Thus, when having the filter query in he headers, urls to the same API endpoint and different filters are considered as the same calls. If we had the query filters in the URL, caching would be per API endpoint + per filter, which does proper caching for most use cases. Should I make a Pull request to have a switch on this in lb.config.ts? |
@Sturgelose thanks for reach out... Hey so, there is already a way to set filters over url within the lb.config.ts You just need to execute that method on your app init. Cheers |
This is a rather "appearance"-related question, but is it possible to set the
filter
parameters to HTTP headers, instead of having them at parsed at the url?I know for a fact that Loopback supports filters like this:
which to me is a lot more readable than eg.
This is especially helpfull when inspecting request in the browsers developer tools.
btw, really cool tool - this SDK builder has helped me a bunch! 👍
Jesper.
The text was updated successfully, but these errors were encountered: