Skip to content

fix(restapi): fix API ignoring query string parameters for GET requests - #158

Open
crabique wants to merge 1 commit into
elemental-lf:masterfrom
crabique:fix/rest-api-query-parameters-parsing
Open

fix(restapi): fix API ignoring query string parameters for GET requests#158
crabique wants to merge 1 commit into
elemental-lf:masterfrom
crabique:fix/rest-api-query-parameters-parsing

Conversation

@crabique

Copy link
Copy Markdown

Hello, it's me again 🙂

Webargs 6.0 changed the behaviour of data location lookups to be single-source instead of a union of all locations, the default now is json and it only looks in there.

This broke the /versions endpoint of the rest-api, because it expects filter_expression and include_blocks as query string parameters: GET method does not have a request body (json) in its specification, so only query string is available.

Inside the route-decorated function call, the following state can be observed:

request.body.getvalue(): filter_expression=123&include_blocks=true
locals(): {'self': <benji.restapi.RestAPI object at 0x7f5a23fc6280>, 'filter_expression': None, 'include_blocks': False}

This change fixes this problem by forcing webargs to look into the query string parameters if it is a GET request, falling back to the default json otherwise.

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

Successfully merging this pull request may close these issues.

1 participant