project icon indicating copy to clipboard operation
project copied to clipboard

tests: content type header is automatically assigned value where value is not provided in request

Open theobadha opened this issue 11 months ago • 1 comments

Summary: The content-type header is automatically assigned a value when sent. During creation of the request, the content-type header is not given a value, but when the request is sent, the header has a value. The value is an invalid value.

Expected Behavior The request should have only headers assigned to it at creation. Where the content type is missing in the header, the response should have a properly descriptive error message: "Missing mandatory element - content-type is required"

Severity: Low

Priority: Low

Request (note the content-type header - this wasn't provided in the toolkit interface)

curl 'http://ml-api-adapter:3000/transfers'
  -H 'content-type: application/json'
  -H 'accept: application/vnd.interoperability.transfers+json;version=1.0'
  -H 'fspiop-source: pinkbankfsp'
  -H 'date: Mon, 20 Jan 2025 13:05:35 GMT'
  -H 'traceparent: 00-aabbdd95d6ae3b2d2f2a694df99e6b59-0123456789abcdef0-00'

Response Sample

{
  "status": 400,
  "statusText": "Bad Request",
  "body": {
    "errorInformation": {
      "errorCode": "3101",
      "errorDescription": "Malformed syntax - Invalid content-type header"
    }
  },
  "headers": {
    "content-type": "application/json; charset=utf-8",
    "cache-control": "no-cache",
    "content-length": "109",
    "date": "Mon, 20 Jan 2025 13:05:36 GMT",
    "connection": "keep-alive",
    "keep-alive": "timeout=5"
  }
}

Specifications

  • Component (if known):
  • Version: 16
  • Platform:
  • Subsystem:
  • Type of testing: api validation
  • Bug found/raised by: Walter

Notes:

  • Severity when opened: Low
  • Priority when opened: Low

theobadha avatar Jan 20 '25 14:01 theobadha

For now we need to live with the default behaviour of TTK for content-type header. The change was rolled back here https://github.com/mojaloop/ml-testing-toolkit/pull/292

shashi165 avatar Jan 29 '25 20:01 shashi165