diff --git a/changedetectionio/api/Watch.py b/changedetectionio/api/Watch.py index f9490e837..18d1d30e0 100644 --- a/changedetectionio/api/Watch.py +++ b/changedetectionio/api/Watch.py @@ -338,7 +338,7 @@ class WatchHistoryDiff(Resource): word_diff = True # Get boolean diff preferences with defaults from DIFF_PREFERENCES_CONFIG - changes_only = strtobool(request.args.get('changesOnly', 'true')) + changes_only = strtobool(request.args.get('changesOnly', 'false')) ignore_whitespace = strtobool(request.args.get('ignoreWhitespace', 'false')) include_removed = strtobool(request.args.get('removed', 'true')) include_added = strtobool(request.args.get('added', 'true')) @@ -349,7 +349,7 @@ class WatchHistoryDiff(Resource): previous_version_file_contents=from_version_file_contents, newest_version_file_contents=to_version_file_contents, ignore_junk=ignore_whitespace, - include_equal=changes_only, + include_equal=not changes_only, include_removed=include_removed, include_added=include_added, include_replaced=include_replaced, @@ -567,4 +567,4 @@ class CreateWatch(Resource): return {'status': f'OK, queueing {len(watches_to_queue)} watches in background'}, 202 - return list, 200 \ No newline at end of file + return list, 200 diff --git a/changedetectionio/tests/test_api.py b/changedetectionio/tests/test_api.py index 37f7b489f..b40e47a1b 100644 --- a/changedetectionio/tests/test_api.py +++ b/changedetectionio/tests/test_api.py @@ -170,6 +170,14 @@ def test_api_simple(client, live_server, measure_memory_usage, datastore_path): headers={'x-api-key': api_key}, ) assert b'(changed) Which is across' in res.data + assert b'Some text thats the same' in res.data + + # Fetch the difference between two versions (default text format) + res = client.get( + url_for("watchhistorydiff", uuid=watch_uuid, from_timestamp='previous', to_timestamp='latest')+"?changesOnly=true", + headers={'x-api-key': api_key}, + ) + assert b'Some text thats the same' not in res.data # Test htmlcolor format res = client.get(