-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1438 from maykinmedia/task/2804-haalcentraal-headers
[#2804] Update headers for requests with Haal Centraal API client
- Loading branch information
Showing
5 changed files
with
127 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/open_inwoner/haalcentraal/migrations/0003_haalcentraalconfig_api_verwerking_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Generated by Django 4.2.16 on 2024-10-15 08:42 | ||
|
||
from django.db import migrations, models | ||
|
||
import open_inwoner.haalcentraal.validators | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("haalcentraal", "0002_auto_20230206_1511"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="haalcentraalconfig", | ||
name="api_verwerking", | ||
field=models.CharField( | ||
blank=True, | ||
help_text="Value of the 'x-verwerking' header for Haalcentraal BRP API requests", | ||
max_length=242, | ||
validators=[ | ||
open_inwoner.haalcentraal.validators.validate_verwerking_header | ||
], | ||
verbose_name="API 'verwerking' header", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="haalcentraalconfig", | ||
name="api_doelbinding", | ||
field=models.CharField( | ||
blank=True, | ||
help_text="Value of the 'x-doelbinding' header for Haalcentraal BRP API requests.", | ||
max_length=64, | ||
verbose_name="API 'doelbinding' header", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="haalcentraalconfig", | ||
name="api_origin_oin", | ||
field=models.CharField( | ||
blank=True, | ||
help_text="Value of the 'x-origin-oin' header for Haalcentraal BRP API requests.", | ||
max_length=64, | ||
verbose_name="API 'OIN' header", | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from django.core.exceptions import ValidationError | ||
from django.utils.translation import gettext as _ | ||
|
||
|
||
def validate_verwerking_header(value: str) -> None: | ||
if value.count("@") > 1: | ||
raise ValidationError( | ||
_("The x-verwerking header must contain at most one '@' character."), | ||
code="no_multiple_at_characters", | ||
) |