-
Notifications
You must be signed in to change notification settings - Fork 68
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
Allow fetching as POST requests #76
Comments
Hey @shaungrady, thanks for the great write-up. This has come up before. I wonder if we might instead add this as a static boolean property on the model class. I like this approach because it's a simple flag we can point to whenever the use case comes up, instead of requiring middleware and breaking compatibility. What do you think? |
I think that approach makes a lot of sense 👌 |
How about fetchAsPost? |
beforeFilters
to modify URL
What serialization behavior for the body would we be looking for? Do we want to re-parse the query params—note the stringified array… { "data": {
"filters": {
"foo": "bar,baz"
}
}}
… or use the straight { "data": {
"filters": {
"foo": ["bar", "baz"]
}
}} |
Given that the URL as passed in as a string to
beforeFilters
, it's unable to be modified.The use case for us is that we have an endpoint that we need to use HTTP POSTs for reads due to very long filter strings.
beforeFilters
allows the HTTP method to be changed to POST, and allows for translating the query string to a POST body, but we're unable to strip the query string from the URL.I'd imagine the fix for this would be nesting the
url
andoptions
filter args under an object, which would be a breaking change. I'd be happy to write a PR if it's decided that this would be an acceptable feature.Another approach might be to check to see if the method has changed from GET to POST/PUT/PATCH and do that translation and query string removal automatically.
The text was updated successfully, but these errors were encountered: