Skip to content

Commit

Permalink
Merge pull request #93 from lundberg/expose-text-html-json
Browse files Browse the repository at this point in the history
Expose text, html and json in high-level API
  • Loading branch information
lundberg authored Oct 14, 2020
2 parents a9479b8 + 746b863 commit 86f7bf7
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 66 deletions.
113 changes: 81 additions & 32 deletions respx/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
ContentDataTypes,
DefaultType,
HeaderTypes,
JSONTypes,
QueryParamTypes,
RequestPattern,
)
Expand Down Expand Up @@ -58,9 +59,12 @@ def add(
*,
params: Optional[QueryParamTypes] = None,
status_code: Optional[int] = None,
content: Optional[ContentDataTypes] = None,
content_type: Optional[str] = None,
headers: Optional[HeaderTypes] = None,
content_type: Optional[str] = None,
content: Optional[ContentDataTypes] = None,
text: Optional[str] = None,
html: Optional[str] = None,
json: Optional[JSONTypes] = None,
pass_through: bool = False,
alias: Optional[str] = None,
) -> RequestPattern:
Expand All @@ -70,9 +74,12 @@ def add(
url=url,
params=params,
status_code=status_code,
content=content,
content_type=content_type,
headers=headers,
content_type=content_type,
content=content,
text=text,
html=html,
json=json,
pass_through=pass_through,
alias=alias,
)
Expand All @@ -83,9 +90,12 @@ def get(
*,
params: Optional[QueryParamTypes] = None,
status_code: Optional[int] = None,
content: Optional[ContentDataTypes] = None,
content_type: Optional[str] = None,
headers: Optional[HeaderTypes] = None,
content_type: Optional[str] = None,
content: Optional[ContentDataTypes] = None,
text: Optional[str] = None,
html: Optional[str] = None,
json: Optional[JSONTypes] = None,
pass_through: bool = False,
alias: Optional[str] = None,
) -> RequestPattern:
Expand All @@ -94,9 +104,12 @@ def get(
url=url,
params=params,
status_code=status_code,
content=content,
content_type=content_type,
headers=headers,
content_type=content_type,
content=content,
text=text,
html=html,
json=json,
pass_through=pass_through,
alias=alias,
)
Expand All @@ -107,9 +120,12 @@ def post(
*,
params: Optional[QueryParamTypes] = None,
status_code: Optional[int] = None,
content: Optional[ContentDataTypes] = None,
content_type: Optional[str] = None,
headers: Optional[HeaderTypes] = None,
content_type: Optional[str] = None,
content: Optional[ContentDataTypes] = None,
text: Optional[str] = None,
html: Optional[str] = None,
json: Optional[JSONTypes] = None,
pass_through: bool = False,
alias: Optional[str] = None,
) -> RequestPattern:
Expand All @@ -118,9 +134,12 @@ def post(
url=url,
params=params,
status_code=status_code,
content=content,
content_type=content_type,
headers=headers,
content_type=content_type,
content=content,
text=text,
html=html,
json=json,
pass_through=pass_through,
alias=alias,
)
Expand All @@ -131,9 +150,12 @@ def put(
*,
params: Optional[QueryParamTypes] = None,
status_code: Optional[int] = None,
content: Optional[ContentDataTypes] = None,
content_type: Optional[str] = None,
headers: Optional[HeaderTypes] = None,
content_type: Optional[str] = None,
content: Optional[ContentDataTypes] = None,
text: Optional[str] = None,
html: Optional[str] = None,
json: Optional[JSONTypes] = None,
pass_through: bool = False,
alias: Optional[str] = None,
) -> RequestPattern:
Expand All @@ -142,9 +164,12 @@ def put(
url=url,
params=params,
status_code=status_code,
content=content,
content_type=content_type,
headers=headers,
content_type=content_type,
content=content,
text=text,
html=html,
json=json,
pass_through=pass_through,
alias=alias,
)
Expand All @@ -155,9 +180,12 @@ def patch(
*,
params: Optional[QueryParamTypes] = None,
status_code: Optional[int] = None,
content: Optional[ContentDataTypes] = None,
content_type: Optional[str] = None,
headers: Optional[HeaderTypes] = None,
content_type: Optional[str] = None,
content: Optional[ContentDataTypes] = None,
text: Optional[str] = None,
html: Optional[str] = None,
json: Optional[JSONTypes] = None,
pass_through: bool = False,
alias: Optional[str] = None,
) -> RequestPattern:
Expand All @@ -166,9 +194,12 @@ def patch(
url=url,
params=params,
status_code=status_code,
content=content,
content_type=content_type,
headers=headers,
content_type=content_type,
content=content,
text=text,
html=html,
json=json,
pass_through=pass_through,
alias=alias,
)
Expand All @@ -179,9 +210,12 @@ def delete(
*,
params: Optional[QueryParamTypes] = None,
status_code: Optional[int] = None,
content: Optional[ContentDataTypes] = None,
content_type: Optional[str] = None,
headers: Optional[HeaderTypes] = None,
content_type: Optional[str] = None,
content: Optional[ContentDataTypes] = None,
text: Optional[str] = None,
html: Optional[str] = None,
json: Optional[JSONTypes] = None,
pass_through: bool = False,
alias: Optional[str] = None,
) -> RequestPattern:
Expand All @@ -190,9 +224,12 @@ def delete(
url=url,
params=params,
status_code=status_code,
content=content,
content_type=content_type,
headers=headers,
content_type=content_type,
content=content,
text=text,
html=html,
json=json,
pass_through=pass_through,
alias=alias,
)
Expand All @@ -203,9 +240,12 @@ def head(
*,
params: Optional[QueryParamTypes] = None,
status_code: Optional[int] = None,
content: Optional[ContentDataTypes] = None,
content_type: Optional[str] = None,
headers: Optional[HeaderTypes] = None,
content_type: Optional[str] = None,
content: Optional[ContentDataTypes] = None,
text: Optional[str] = None,
html: Optional[str] = None,
json: Optional[JSONTypes] = None,
pass_through: bool = False,
alias: Optional[str] = None,
) -> RequestPattern:
Expand All @@ -214,9 +254,12 @@ def head(
url=url,
params=params,
status_code=status_code,
content=content,
content_type=content_type,
headers=headers,
content_type=content_type,
content=content,
text=text,
html=html,
json=json,
pass_through=pass_through,
alias=alias,
)
Expand All @@ -227,9 +270,12 @@ def options(
*,
params: Optional[QueryParamTypes] = None,
status_code: Optional[int] = None,
content: Optional[ContentDataTypes] = None,
content_type: Optional[str] = None,
headers: Optional[HeaderTypes] = None,
content_type: Optional[str] = None,
content: Optional[ContentDataTypes] = None,
text: Optional[str] = None,
html: Optional[str] = None,
json: Optional[JSONTypes] = None,
pass_through: bool = False,
alias: Optional[str] = None,
) -> RequestPattern:
Expand All @@ -238,9 +284,12 @@ def options(
url=url,
params=params,
status_code=status_code,
content=content,
content_type=content_type,
headers=headers,
content_type=content_type,
content=content,
text=text,
html=html,
json=json,
pass_through=pass_through,
alias=alias,
)
Loading

0 comments on commit 86f7bf7

Please sign in to comment.