From 8bd3904e714b9473d7adad1756ecfbca2217814d Mon Sep 17 00:00:00 2001 From: debugtalk Date: Thu, 4 Jun 2020 14:13:53 +0800 Subject: [PATCH] fix: missing request json --- docs/CHANGELOG.md | 5 +++++ httprunner/make.py | 4 ++++ httprunner/testcase.py | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 4fca7a0c..05718bb4 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -6,6 +6,11 @@ - feat: add sentry sdk +**Fixed** + +- fix: missing request json +- fix: override testsuite/testcase config verify + **Changed** - change: add httprunner version in generated pytest file diff --git a/httprunner/make.py b/httprunner/make.py index eaa7d309..aaab8987 100644 --- a/httprunner/make.py +++ b/httprunner/make.py @@ -175,6 +175,10 @@ def make_request_chain_style(request: Dict) -> Text: data = f'"{data}"' request_chain_style += f".with_data({data})" + if "json" in request: + req_json = request["json"] + request_chain_style += f".with_json({req_json})" + if "timeout" in request: timeout = request["timeout"] request_chain_style += f".set_timeout({timeout})" diff --git a/httprunner/testcase.py b/httprunner/testcase.py index bcbfb07d..25572275 100644 --- a/httprunner/testcase.py +++ b/httprunner/testcase.py @@ -215,6 +215,10 @@ class RequestWithOptionalArgs(object): self.__t_step.request.data = data return self + def with_json(self, req_json) -> "RequestWithOptionalArgs": + self.__t_step.request.req_json = req_json + return self + def set_timeout(self, timeout: float) -> "RequestWithOptionalArgs": self.__t_step.request.timeout = timeout return self