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

Collection.action always has an empty request body #228

Open
RamtinYazdanian opened this issue May 17, 2022 · 0 comments
Open

Collection.action always has an empty request body #228

RamtinYazdanian opened this issue May 17, 2022 · 0 comments

Comments

@RamtinYazdanian
Copy link

The method Collection.action is meant to allow access to the ArangoDB HTTP endpoints that do not have a dedicated method in Collection. However, the method always sends an empty request body. Here's the code:

def action(self, method, action, **params):
        """a generic fct for interacting everything that doesn't have an assigned fct"""
        fct = getattr(self.connection.session, method.lower())
        r = fct(self.getURL()   "/"   action, params = params)
        return r.json()

In the fourth line above, the session's HTTP method is called without a data argument. Everything aside from the URL is passed to the HTTP method through the params argument, which the method would treat as an additional keyword argument, leaving data with its default value (which is None). Consequently, none of the POST or PUT endpoints work using this method (I was trying to use the PUT /_api/collection/{collection-name}/properties endpoint when I discovered this error).

To fix the issue, params['data'] should be passed to the data argument, and the rest of params should be passed as kwargs.

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

1 participant