-
Notifications
You must be signed in to change notification settings - Fork 839
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
setPlainByDefault does not strip etag from responses #1453
Comments
@lucioperca I added some unit tests for your use case and they come through clean without modification of Restangular. Can you check the PR and see if the tests makes sense, especially here? I'm doing a GET operation which responds with a header What version of Restangular are you using? |
@bostrom I checked the tests in the PR. It looks like the |
This seems to happen because https://github.com/mgonto/restangular/blob/master/src/restangular.js#L1140 |
Took a stab at fixing this (as well as fixing one of my modified unit tests). See updated: |
Yes, you're right, my Thanks for the PR, awesome! I see the problem now, it's the fact that the restangularEtag field is set in the EDIT: Actually that's just what you said 🙄
I would consider that the bug here, and moving the setting of What do you think, can you update your PR and instead of deleting the etag property, you would set it inside the |
@bostrom I agree with that idea in principle, but I'm not sure how best to go about it. It looks like If I can find time I'll fiddle around with it and see if I can modify the function given the above. |
@lucioperca yes, I noticed that it might require some more profound changes due to the facts you present. But have a look what you can do if you have time, and if not then I'll return to this issue in a while. I'm just now in the process of refactoring the codebase a bit to be able to write some better unit tests. With the unit tests in place, I'll hopefully be able to restructure the code to cater for easier bug fixes and features. It's a tedious and time consuming process though... 😓 |
Any workaround that you know of to solve this issue? It's really frustrating I can't seem to be able to handle this |
Maybe I am just dumb, but why cant perseResponse be moved after the plain return? |
Restangular is configured with
setPlainByDefault(true)
. When running a query such asget()
orgetList()
that retrieves a response with an ETag exposed, the result contains restangularEtag.This is inconsistent with the behavior when calling
plain()
on the result directly, even though these are apparently intended to have the same outcome. (94ffaf0)The text was updated successfully, but these errors were encountered: