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.

Ability to pre-parse response to flag as error based on JSON in response

See original GitHub issue

Our server wraps errors so we get a 200 with a "success": false within the returned JSON and then an error object with the error code. When I see the current Chucker list it looks like everything is perfect as it is all 200 but I would love to be able to pre-process the return to see if it really was an error and show the 200 in RED or to extract the internal code and error to have Chucker show that instead of the original unwrapped 200.

Would love some way to either flag any response as an error before it is added to the list (so it shows in RED) or even deeper processing to extract the error and text I want.

Might be too specific of an issue for team to tackle but might solve some issues for others as well.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
MiSikoracommented, Mar 1, 2021

In 4.x we plan to add a possibility to install custom body decoders. They were added in order to decode binary formats like protobuf but you can use them for your specific task as well. Right now it is available only in snapshot version but I don’t expect a lot of changes (if any) to this feature.

You can write your custom decoder that removes envelopes from payloads. Here is an example that reverses received bodies.

https://github.com/ChuckerTeam/chucker/blob/186a3df44f57846d899c23e3a4f5770b683a7ef9/library/src/test/java/com/chuckerteam/chucker/api/ChuckerInterceptorDecodingTest.kt#L176-L179

Here is a little bit more info about the feature.

0reactions
vbuberencommented, Mar 3, 2021

I don’t find such feature useful for Chucker, since I believe that sending errors with 200 response code isn’t correct.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to skip 'noise' in a JSON object stream? - Stack Overflow
I think the "correct" way to do this, as the stream itself is not valid JSON (even without the errors, a JSON document...
Read more >
src/flag-definitions.h - v8 - Google Git
We need to define all of our default values so that the Flag structure can ... DEFINE_BOOL(trace_debug_json, false, "trace debugging JSON request/response").
Read more >
uhaha/uhaha.go at master · tidwall/uhaha - GitHub
operation is ignored when a data directory already exists. Cannot be used with -j flag. --init-run-quit : initialize a bootstrap operation and ...
Read more >
REST API - JSON Invalid format - Splunk Community
Is there anything we need to do to get the valid json data via REST API? ... Having to pre-parse a JSON response...
Read more >
RFC 8881 - Network File System (NFS) Version 4 Minor ...
To add specific features based on experience with the existing protocol and ... Therefore, an NFSv4.1 server MUST NOT return NFS4ERR_WRONGSEC in 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