How can I see ChromeLogger output in the Postman console when debugging an API?

scipilot

I have set up ChromeLogger, the browser extension and the backend library, which works fine.

However I am developing an API which I test in Postman not in the browser so I want to see the same debug logs in Postman in the console or somewhere in the response previews.

Is there any way of installing an extension into Postman, the same as the browser extension?

scipilot

After reading this article, which explains how the debug logs are encoded in a header, I thought I could just write a post-response "test" in Postman to unpack the header and log it into the Postman console.

This Postman article explains how you can set a "test" globally by editing the test suite itself or folders, so you can make this work pretty much like an extension without having to add it to each request. Click the '...' ellipsis next to the test suite, click Edit, choose the Tests tab and enter the JavaScript code below.

I tried three ways of outputting the data, each with their strengths and weaknesses, as noted in the comments.

// Decode any ChromeLogger data
var chromelogger = postman.getResponseHeader("X-ChromeLogger-Data");
if(chromelogger){
    chromelogger = JSON.parse(atob(chromelogger));
    if(chromelogger){

        // Native objects - well structured, but you have to expand all the rows every time... tedious!
        //console.log(chromelogger); 

        // Raw JSON - always visible but can be hard to read
        // console.log(atob(postman.getResponseHeader("X-ChromeLogger-Data"))); 

        // For known structures, you can display it yourself
        chromelogger.rows.forEach( row => {
            console.log(row[1]); // display source line
            row[0].forEach(log => {
                console.log(log);
            })
        })
    }
}

Now when you run any test, all the Chromelogger debug is displayed in the Postman Console.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How can I see my LAN when connected to a VPN?

分類Dev

How can I see when the field changes alphabetically in mongodb?

分類Dev

How can I easily see the JSON output from my objects that conform to the `Codable` Protocol

分類Dev

How can I avoid "environment hell" in postman?

分類Dev

Rust: How do I overwrite console output?

分類Dev

How can I see what processes are running?

分類Dev

How can I see the full layout in Android?

分類Dev

Postman: How can I set my postman to use "pm" instead of "postman"

分類Dev

How do I see what output options are available in my proc?

分類Dev

What Kubernetes API endpoint can I use to see if there are unscheduled pods?

分類Dev

How can I make AutoLayout crash my app when it logs unsatisfiable constraints in debug console?

分類Dev

How can I see the I/O activity of certain programs?

分類Dev

How can I validate JSON array value in postman?

分類Dev

How do I skip external code when debugging in VS Code

分類Dev

How to reset explorer.exe when I can't see it? Text not populating in Task Manager, Windows Explorer, and some other programs

分類Dev

How do I capture the console output for a container launched on ECS?

分類Dev

How do I run "ls" and then print the output to the console?

分類Dev

When I use SSH with web browser on AWS Console. How I can set my security group source?

分類Dev

How can I Save a Python Script output to a file when using Command Prompt?

分類Dev

How can I sort an array so that the output is always an array, even when the input array is empty?

分類Dev

APIをデバッグするときにPostmanコンソールでChromeLoggerの出力を確認するにはどうすればよいですか?

分類Dev

Where is the standard output of QtCreator when debugging?

分類Dev

No output produced for C# Console Application on 'Start without Debugging'

分類Dev

How can I see all versions of a package that are available in the archive?

分類Dev

How can I see the aggregated logs for a Spark standalone cluster

分類Dev

How can I see callerIP on BigQuery's AuditLog?

分類Dev

How can I see the actual commands (java) running in Intellij Idea?

分類Dev

How I can see the actual bit sequence of 0.1 in Python?

分類Dev

In R, how can I see the signatures for which a generic method is implemented?

Related 関連記事

  1. 1

    How can I see my LAN when connected to a VPN?

  2. 2

    How can I see when the field changes alphabetically in mongodb?

  3. 3

    How can I easily see the JSON output from my objects that conform to the `Codable` Protocol

  4. 4

    How can I avoid "environment hell" in postman?

  5. 5

    Rust: How do I overwrite console output?

  6. 6

    How can I see what processes are running?

  7. 7

    How can I see the full layout in Android?

  8. 8

    Postman: How can I set my postman to use "pm" instead of "postman"

  9. 9

    How do I see what output options are available in my proc?

  10. 10

    What Kubernetes API endpoint can I use to see if there are unscheduled pods?

  11. 11

    How can I make AutoLayout crash my app when it logs unsatisfiable constraints in debug console?

  12. 12

    How can I see the I/O activity of certain programs?

  13. 13

    How can I validate JSON array value in postman?

  14. 14

    How do I skip external code when debugging in VS Code

  15. 15

    How to reset explorer.exe when I can't see it? Text not populating in Task Manager, Windows Explorer, and some other programs

  16. 16

    How do I capture the console output for a container launched on ECS?

  17. 17

    How do I run "ls" and then print the output to the console?

  18. 18

    When I use SSH with web browser on AWS Console. How I can set my security group source?

  19. 19

    How can I Save a Python Script output to a file when using Command Prompt?

  20. 20

    How can I sort an array so that the output is always an array, even when the input array is empty?

  21. 21

    APIをデバッグするときにPostmanコンソールでChromeLoggerの出力を確認するにはどうすればよいですか?

  22. 22

    Where is the standard output of QtCreator when debugging?

  23. 23

    No output produced for C# Console Application on 'Start without Debugging'

  24. 24

    How can I see all versions of a package that are available in the archive?

  25. 25

    How can I see the aggregated logs for a Spark standalone cluster

  26. 26

    How can I see callerIP on BigQuery's AuditLog?

  27. 27

    How can I see the actual commands (java) running in Intellij Idea?

  28. 28

    How I can see the actual bit sequence of 0.1 in Python?

  29. 29

    In R, how can I see the signatures for which a generic method is implemented?

ホットタグ

アーカイブ