fix(003_06, 003_08): a batch whose @context and Content-Type do not match is a 400 for the whole request

TS 104-176 clause 6.2.4: with Content-Type: application/json, an @context in the payload body raises BadRequestData; with application/ld+json, a body without @context does.

The mismatch is a property of the request - its header and its body - not of one entity in the batch. So the answer is a 400 with a ProblemDetails body, not a 207 with a per-entity error.

  • 003_06_01: JSON Content-Type, entities carrying @context -> 400 BadRequestData
  • 003_08_01: JSON-LD Content-Type, entities without @context -> 400 BadRequestData

2 Test Cases, expectations only (status code and where the ProblemDetails is read). Both fail on develop and pass with this MR against a broker that follows clause 6.2.4.

Merge request reports

Loading
+3 −3
Changes for TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_06.robot: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -17,9 +17,9 @@ Resource ${EXECDIR}/resources/JsonUtils.resource

    ${response}=    Batch Create Entities    @{entities_to_be_created}    content_type=${CONTENT_TYPE_JSON}

    Check Response Status Code    207    ${response.status_code}
    Check Response Status Code    400    ${response.status_code}
    Check Response Body Containing ProblemDetails Element Containing Type Element set to
    ...    ${response.json()['errors'][0]['error']}
    ...    ${response.json()}
    ...    ${ERROR_TYPE_BAD_REQUEST_DATA}
    Check Response Body Containing ProblemDetails Element Containing Title Element
    ...    ${response.json()['errors'][0]['error']}
    ...    ${response.json()}
+3 −3
Changes for TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_08.robot: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -17,9 +17,9 @@ Resource ${EXECDIR}/resources/JsonUtils.resource

    ${response}=    Batch Create Entities    @{entities_to_be_created}    content_type=${CONTENT_TYPE_LD_JSON}

    Check Response Status Code    207    ${response.status_code}
    Check Response Status Code    400    ${response.status_code}
    Check Response Body Containing ProblemDetails Element Containing Type Element set to
    ...    ${response.json()['errors'][0]['error']}
    ...    ${response.json()}
    ...    ${ERROR_TYPE_BAD_REQUEST_DATA}
    Check Response Body Containing ProblemDetails Element Containing Title Element
    ...    ${response.json()['errors'][0]['error']}
    ...    ${response.json()}
Loading