question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for pretty printing request bodies (modifyRequest?)

See original GitHub issue

With modifyResponseTo(prettyPrintContent()) the response bodies can be pretty printed.

Is there support to do something similar for request bodies?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Sarvesh-Dcommented, Jan 31, 2020

As per docs for 2.0.4 spring rest docs can pretty print request via prettyPrint() processor.

this.mockMvc = MockMvcBuilders.webAppContextSetup(ctx)
                                      .alwaysDo(JacksonResultHandlers.prepareJackson(mapper))
                                      .apply(MockMvcRestDocumentation.documentationConfiguration(restDocumentation).operationPreprocessors().withRequestDefaults(prettyPrint());

This works for me.

0reactions
daliborfiluscommented, Jul 14, 2018

I’m using this - which will format all requests and responses during the test run:

class XXXTest {

    @Autowired
    private lateinit var objectMapper: ObjectMapper

    @Before
    fun setup() {
        // pretty print jsons so we are getting nice request and response bodies
        objectMapper.configure(SerializationFeature.INDENT_OUTPUT, true)
    }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Pretty Printing HTTP Requests in Golang | by Mike Mackintosh
To help make this simpler, I created the following function which will take a *http.Request object and print out a readable version of...
Read more >
How to modify request body - node.js - Stack Overflow
From MDN docs: request.json().then(function(data) { // do something with your data });. This should help you get started:
Read more >
REST Request Test Step | ReadyAPI Documentation
Displays the request body as a tree. Works for POST and PUT requests only. You can change elements' and attributes' values in-place. Just...
Read more >
pprint — Data pretty printer — Python 3.11.1 documentation
Changed in version 3.10: Added support for pretty-printing dataclasses.dataclass . The pprint module defines one class: class pprint.PrettyPrinter(indent=1 ...
Read more >
Web Requests with Python - Pluralsight
Request Package: Use python package manager (pip) command in the ... modify request headers 3print(response.headers) # print response ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found