Skip to content
This repository has been archived by the owner on May 26, 2021. It is now read-only.

Replace request path with the full path with request arguments #69

Merged
merged 2 commits into from
Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions http_stubs/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ def test_exist_regexp_stub(self, method: str, http_stub_factory, client):
}
http_stub_factory(
method=method,
path=r'/test/\d+/',
path=r'/test/\d+/\?arg=\w+',
regex_path=True,
resp_body=resp_body,
resp_status=resp_status,
resp_content_type=resp_content_type,
resp_headers=resp_headers,
)
resp_method = method.lower()
response = getattr(client, resp_method)('/test/100500/')
response = getattr(client, resp_method)('/test/100500/?arg=test')

if method != HTTPMethod.HEAD.name:
assert response.content == resp_body.encode('utf-8')
Expand Down
2 changes: 1 addition & 1 deletion http_stubs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def dispatch(self, request: HttpRequest, *args, **kwargs) -> HttpResponse:
:param kwargs: request kwargs
:returns: http response
"""
stub = self.find_stub(request.method, f'/{kwargs["path"]}')
stub = self.find_stub(request.method, request.get_full_path())
if not stub:
return HttpResponseNotFound()
LogEntry.objects.create(
Expand Down