Skip to content
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

Configurable delegate to allow post-formatting the response #56

Open
adrianiftode opened this issue Mar 26, 2021 · 0 comments
Open

Configurable delegate to allow post-formatting the response #56

adrianiftode opened this issue Mar 26, 2021 · 0 comments

Comments

@adrianiftode
Copy link
Owner

adrianiftode commented Mar 26, 2021

Use case:

Consider the following response:

Expected HTTP response to be "OK", but found InternalServerError.
    
    The HTTP response was:
    
    HTTP/1.1 500 InternalServerError
    Set-Cookie: XSRF-TOKEN=aaaaaaaaaaaaaaaaaaaaaaa; path=/
    Content-Type: application/json
    Content-Length: 3963
    
    {
        "traceId": "traceba9919c5493c503a",
        "message": "An error has occurred.",
        "exceptionMessage": "Object reference not set to an instance of an object.",
        "exceptionType": "NullReferenceException",
        "stackTrace": "    at SomeClass.SomeMethod() in C:\\dev\\Tracker.cs:line 111\r\n     at SomeMethod() in C:\\dev\\workspace\\Someclasss.cs:line 43"
    }
    The originated HTTP request was:

The stacktrace property is not easily readable as it is formatted as a one-line string. Would be useful to intercept the response and replace "\r\n" with the actual new lines.

So an expected output would be

Expected HTTP response to be "OK", but found InternalServerError.
    
    The HTTP response was:
    
    HTTP/1.1 500 InternalServerError
    Set-Cookie: XSRF-TOKEN=aaaaaaaaaaaaaaaaaaaaaaa; path=/
    Content-Type: application/json
    Content-Length: 3963
    
    {
        "traceId": "traceba9919c5493c503a",
        "message": "An error has occurred.",
        "exceptionMessage": "Object reference not set to an instance of an object.",
        "exceptionType": "NullReferenceException",
        "stackTrace": "   at SomeClass.SomeMethod() in C:\\dev\\Tracker.cs:line 111
     at SomeMethod() in C:\\dev\\workspace\\Someclasss.cs:line 43"
    }
    The originated HTTP request was:

And thus would ease reading the stack trace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant