Skip to content

Commit c3d4b76

Browse files
committed
httpserver: additional fix for #16
Fix docstrings and type annotations according to issue #16.
1 parent acbe368 commit c3d4b76

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

pytest_httpserver/httpserver.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ def expect_request(
476476
data: Union[str, bytes, None] = None,
477477
data_encoding: str = "utf-8",
478478
headers: Optional[Mapping[str, str]] = None,
479-
query_string: Optional[str] = None,
479+
query_string: Union[None, bytes, str] = None,
480480
header_value_matcher: Optional[HeaderValueMatcher] = None,
481481
handler_type: HandlerType = HandlerType.PERMANENT) -> RequestHandler:
482482
"""
@@ -501,7 +501,9 @@ def expect_request(
501501
by default, see `data_encoding`) or a bytes object.
502502
:param data_encoding: the encoding used for data parameter if data is a string.
503503
:param headers: dictionary of the headers of the request to be matched
504-
:param query_string: the http query string starting with ``?``, such as ``?username=user``
504+
:param query_string: the http query string, after ``?``, such as ``username=user``.
505+
If string is specified it will be encoded to bytes with the encode method of
506+
the string.
505507
:param header_value_matcher: :py:class:`HeaderValueMatcher` that matches values of headers.
506508
:param handler_type: type of handler
507509
@@ -533,7 +535,7 @@ def expect_oneshot_request(
533535
data: Union[str, bytes, None] = None,
534536
data_encoding: str = "utf-8",
535537
headers: Optional[Mapping[str, str]] = None,
536-
query_string: Optional[str] = None,
538+
query_string: Union[None, bytes, str] = None,
537539
header_value_matcher: Optional[HeaderValueMatcher] = None) -> RequestHandler:
538540
"""
539541
Create and register a oneshot request handler.
@@ -547,7 +549,9 @@ def expect_oneshot_request(
547549
by default, see `data_encoding`) or a bytes object.
548550
:param data_encoding: the encoding used for data parameter if data is a string.
549551
:param headers: dictionary of the headers of the request to be matched
550-
:param query_string: the http query string starting with ``?``, such as ``?username=user``
552+
:param query_string: the http query string, after ``?``, such as ``username=user``.
553+
If string is specified it will be encoded to bytes with the encode method of
554+
the string.
551555
:param header_value_matcher: :py:class:`HeaderValueMatcher` that matches values of headers.
552556
553557
:return: Created and register :py:class:`RequestHandler`.
@@ -571,7 +575,7 @@ def expect_ordered_request(
571575
data: Union[str, bytes, None] = None,
572576
data_encoding: str = "utf-8",
573577
headers: Optional[Mapping[str, str]] = None,
574-
query_string: Optional[str] = None,
578+
query_string: Union[None, bytes, str] = None,
575579
header_value_matcher: Optional[HeaderValueMatcher] = None) -> RequestHandler:
576580
"""
577581
Create and register a ordered request handler.
@@ -585,7 +589,9 @@ def expect_ordered_request(
585589
by default, see `data_encoding`) or a bytes object.
586590
:param data_encoding: the encoding used for data parameter if data is a string.
587591
:param headers: dictionary of the headers of the request to be matched
588-
:param query_string: the http query string starting with ``?``, such as ``?username=user``
592+
:param query_string: the http query string, after ``?``, such as ``username=user``.
593+
If string is specified it will be encoded to bytes with the encode method of
594+
the string.
589595
:param header_value_matcher: :py:class:`HeaderValueMatcher` that matches values of headers.
590596
591597
:return: Created and register :py:class:`RequestHandler`.

0 commit comments

Comments
 (0)