New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Render body according to its request content type (#261) #331
Render body according to its request content type (#261) #331
Conversation
Thank you for supporting ScanAPI, and congratulations on your first contribution! A project committer will shortly review your contribution.
In the mean time, if you haven't had a chance please skim over the First Pull Request Guide which all pull requests must adhere to.
We hope to see you around!
`body.decode()` is used only once.
…er-body-according-to-its-request-content-type
110f9ba
to
0bbf0e0
Compare
…er-body-according-to-its-request-content-type
Hi @beatorizu, I am awfully sorry for the long delay answering you here. The last month was too busy and I didn't have time to follow all the PRs here.
The PR looks great, btw! I've just left one comment about tests. Please, let me know if you need any help
| @@ -20,3 +21,12 @@ def _loader(is_external): | |||
| return FileSystemLoader(searchpath="./") | |||
|
|
|||
| return PackageLoader("scanapi", "templates") | |||
|
|
|||
|
|
|||
| def render_body(request): | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to have tests for this? The test file for this part is https://github.com/scanapi/scanapi/blob/master/tests/unit/test_template_render.py
Here you can find a brief guideline to help you with the tests: https://github.com/scanapi/scanapi/wiki/Run-ScanAPI-Locally#tests
| @@ -449,7 +449,8 @@ <h3>Request</h3> | |||
| {% if ( request.body and request.body.decode("UTF-8") != "{}" ) %} | |||
| <details> | |||
| <summary>Body</summary> | |||
| <p>{{ request.body }}</p> | |||
| <p class="json-body">{{ request|render_body }}</p> | |||
| <button class="copy__snippet">❏</button> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
I changed my setup recentely, so I will set the environment and add the test :) |
Resolves #261