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.

Error using bodyFilter with jsonPath

See original GitHub issue

I’m using logbook version 2.9.0 and I’d like to mask a specific attribute (cpf) in the request and response body. The bean that I created is below:

@Bean 
public Logbook logbook() {
   return Logbook.builder()
        .bodyFilter(jsonPath("$.cpf").replace(compile("(\\d{3})(\\d{3})(\\d{3})-?(\\d{2})"), "$1.XXX.$3-XX"))
        .bodyFilter(jsonPath("$.results.client.cpf").replace(compile("(\\d{3})(\\d{3})(\\d{3})-?(\\d{2})"), "$1.XXX.$3-XX"))
        .build();
}

When I make an request with body {“cpf”: “21343575698”}, an error occur: “Missing property in path $[‘results’]”,“trace”:“com.jayway.jsonpath.PathNotFoundException: Missing property in path $[‘results’]”

is there something wrong with my configuration?

Thanks a lot.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
StephenOkeleke97commented, Oct 27, 2022

It looks like the problem of throwing an exception if a path is missing still exists. This prevents valid paths from being parsed and filtered

0reactions
swanandi25commented, Dec 22, 2021

@whiskeysierra are jsonpath body filters are still experimental feature or can be used in real time projects?

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Found nothing" error with JSONPath filter and gatling
Your expression is correct, this was indeed a bug. It's fixed in 0.6.3 that was just released. Thanks for reporting.
Read more >
BodyFilters (Logbook: Core 1.12.1 API) - javadoc.io
Creates a BodyFilter that replaces the properties in the json response with the replacement passed as argument. This BodyFilter works on all levels...
Read more >
Using JSON API to query your Search API indexes - matt glaman
The JSON API module exposes collection routes, which allows retrieving multiple resources in a single request. You can also pass filters to ...
Read more >
Activate API management - Airheads Community
I'm doing a very simple python 3 Script to query the activate inventory. The problem is that the server is ignoring the body...
Read more >
net45/Resources/interconnecttaskMetadata ... - PowerShell Gallery
net45/Resources/interconnecttaskMetadata.json ... ","structure_id":"com.vmware.vapi.std.errors.unauthorized"},{"documentation":"Internal Server Error" ...
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