Skip to content

Commit

Permalink
Merge pull request #20 from Wesmania/fix-quoted-filter-values
Browse files Browse the repository at this point in the history
Don't explicitly quote filter values
  • Loading branch information
ajjn authored Jul 16, 2018
2 parents c5e7156 + fd77fe4 commit 3d1a6fc
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/jsonapi_client/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ def format_filter_query(self, **kwargs: 'FilterKeywords') -> str:
"""
def jsonify_key(key):
return key.replace('__', '.').replace('_', '-')
return '&'.join(f'filter[{jsonify_key(key)}]="{value}"'
return '&'.join(f'filter[{jsonify_key(key)}]={value}'
for key, value in kwargs.items())
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ def test_result_filtering(mocked_fetch, api_schema):
s = Session('http://localhost:8080/', schema=api_schema)

result = s.get('test_leases', Filter(title='Dippadai'))
result2 = s.get('test_leases', Filter(f'filter[title]="Dippadai"'))
result2 = s.get('test_leases', Filter(f'filter[title]=Dippadai'))

assert result == result2

Expand Down

0 comments on commit 3d1a6fc

Please sign in to comment.