Repository: fkie-cad/Logprep (language: python)

Issue:
Requester documentation examples are out of date
The examples in the documentation of the Requester are no longer valid.
`header` should be `headers` and `content_type` is not valid.

Link:
https://logprep.readthedocs.io/en/latest/user_manual/configuration/processor.html#id111


Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 00bdda7da..7599c9070 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,16 +10,16 @@
 ### Features
 ### Improvements
 
+* fix `requester` documentation
 * replace `BaseException` with `Exception` for custom errors
 * refactor `generic_resolver` to validate rules on startup instead of application of each rule
 * rewrite the helper method `add_field_to` such that it always raises an `FieldExistsWarning` instead of return a bool.
 * add new helper method `add_fields_to` to directly add multiple fields to one event
 * refactored some processors to make use of the new helper methods
 
-
 ### Bugfix
 
-- fix `confluent_kafka.store_offsets` if `last_valid_record` is `None`, can happen if a rebalancing happens
+* fix `confluent_kafka.store_offsets` if `last_valid_record` is `None`, can happen if a rebalancing happens
   before the first message was pulled.
 - fix pseudonymizer cache metrics not updated
 
diff --git a/logprep/processor/requester/rule.py b/logprep/processor/requester/rule.py
index c5b86fa3b..0ba2fb0ac 100644
--- a/logprep/processor/requester/rule.py
+++ b/logprep/processor/requester/rule.py
@@ -16,9 +16,8 @@
     requester:
       url: https://internal.cmdb.local/api/v1/locations
       method: POST
-      content_type: application/json
       target_field: cmdb.location
-      header:
+      headers:
         Authorization: Bearer askdfjpiowejf283u9r
       json:
         hostname: ${message.hostname}


Test patch:
diff --git a/tests/unit/processor/requester/test_requester_rule.py b/tests/unit/processor/requester/test_requester_rule.py
index 1c7ebdbf3..e8973b126 100644
--- a/tests/unit/processor/requester/test_requester_rule.py
+++ b/tests/unit/processor/requester/test_requester_rule.py
@@ -1,6 +1,7 @@
 # pylint: disable=protected-access
 # pylint: disable=missing-docstring
 import pytest
+
 from logprep.processor.requester.rule import RequesterRule
 
 
@@ -16,6 +17,21 @@ def test_create_from_dict_returns_requester_rule(self):
     @pytest.mark.parametrize(
         ["rule", "error", "message"],
         [
+            (
+                {
+                    "filter": "domain",
+                    "requester": {
+                        "url": "https://internal.cmdb.local/api/v1/locations",
+                        "method": "POST",
+                        "target_field": "cmdb.location",
+                        "headers": {"Authorization": "Bearer askdfjpiowejf283u9r"},
+                        "json": {"hostname": "${message.hostname}"},
+                    },
+                    "description": "...",
+                },
+                None,
+                None,
+            ),
             (
                 {
                     "filter": "message",