mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 15:46:07 -05:00
Return 400 if references missing from cancel broadcast
If someone tries to cancel a broadcast but the references don’t match and existing broadcast we correctly return a 404. If they don’t provide any references then we get an exception. This commit catches the missing references and returns a 400. I think this is more appropriate because it’s malformed request, rather than a well-formed request that doesn’t match our data. It also lets us write a more specific and helpful error message.
This commit is contained in:
@@ -45,7 +45,7 @@ WAINFLEET_CANCEL = """
|
||||
<source>Flood warning service</source>
|
||||
<scope>Public</scope>
|
||||
<code></code>
|
||||
<references>www.gov.uk/environment-agency,50385fcb0ab7aa447bbd46d848ce8466E,2020-02-16T23:01:13-00:00</references>
|
||||
{}
|
||||
<info>
|
||||
<language>en-GB</language>
|
||||
<category>Met</category>
|
||||
@@ -70,6 +70,16 @@ WAINFLEET_CANCEL = """
|
||||
</alert>
|
||||
"""
|
||||
|
||||
WAINFLEET_CANCEL_WITH_REFERENCES = WAINFLEET_CANCEL.format(
|
||||
"<references>www.gov.uk/environment-agency,50385fcb0ab7aa447bbd46d848ce8466E,2020-02-16T23:01:13-00:00</references>"
|
||||
)
|
||||
WAINFLEET_CANCEL_WITH_MISSING_REFERENCES = WAINFLEET_CANCEL.format(
|
||||
""
|
||||
)
|
||||
WAINFLEET_CANCEL_WITH_EMPTY_REFERENCES = WAINFLEET_CANCEL.format(
|
||||
"<references></references>"
|
||||
)
|
||||
|
||||
UPDATE = """
|
||||
<alert xmlns="urn:oasis:names:tc:emergency:cap:1.2">
|
||||
<identifier>PAAQ-4-mg5a94</identifier>
|
||||
|
||||
Reference in New Issue
Block a user