Skip to content

Commit 132ebaa

Browse files
ekneg54dtrai2
andauthored
fix requester documentation (#702)
* fix example and check it in a test * add entry to CHANGELOG.md --------- Co-authored-by: dtrai2 <[email protected]>
1 parent 9c9b877 commit 132ebaa

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

CHANGELOG.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010
### Features
1111
### Improvements
1212

13+
* fix `requester` documentation
1314
* replace `BaseException` with `Exception` for custom errors
1415
* refactor `generic_resolver` to validate rules on startup instead of application of each rule
1516
* rewrite the helper method `add_field_to` such that it always raises an `FieldExistsWarning` instead of return a bool.
1617
* add new helper method `add_fields_to` to directly add multiple fields to one event
1718
* refactored some processors to make use of the new helper methods
1819

19-
2020
### Bugfix
2121

22-
- fix `confluent_kafka.store_offsets` if `last_valid_record` is `None`, can happen if a rebalancing happens
22+
* fix `confluent_kafka.store_offsets` if `last_valid_record` is `None`, can happen if a rebalancing happens
2323
before the first message was pulled.
2424
- fix pseudonymizer cache metrics not updated
2525

logprep/processor/requester/rule.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
requester:
1717
url: https://internal.cmdb.local/api/v1/locations
1818
method: POST
19-
content_type: application/json
2019
target_field: cmdb.location
21-
header:
20+
headers:
2221
Authorization: Bearer askdfjpiowejf283u9r
2322
json:
2423
hostname: ${message.hostname}

tests/unit/processor/requester/test_requester_rule.py

+16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# pylint: disable=protected-access
22
# pylint: disable=missing-docstring
33
import pytest
4+
45
from logprep.processor.requester.rule import RequesterRule
56

67

@@ -16,6 +17,21 @@ def test_create_from_dict_returns_requester_rule(self):
1617
@pytest.mark.parametrize(
1718
["rule", "error", "message"],
1819
[
20+
(
21+
{
22+
"filter": "domain",
23+
"requester": {
24+
"url": "https://internal.cmdb.local/api/v1/locations",
25+
"method": "POST",
26+
"target_field": "cmdb.location",
27+
"headers": {"Authorization": "Bearer askdfjpiowejf283u9r"},
28+
"json": {"hostname": "${message.hostname}"},
29+
},
30+
"description": "...",
31+
},
32+
None,
33+
None,
34+
),
1935
(
2036
{
2137
"filter": "message",

0 commit comments

Comments
 (0)