ScorpioBroker / ScorpioBroker

NGSI-LD compliant context broker named Scorpio. Developed by NEC Laboratories Europe and NEC Technologies India
BSD 3-Clause "New" or "Revised" License
61 stars 39 forks source link

Broker returns text/plain type when Accept is */* #312

Closed kiskit closed 2 years ago

kiskit commented 2 years ago

Hello,

When sending a request ending in error, with an Accept header set to */*, the response is sent with Content-Type set to text/plain. Shouldn't it be application/json?

Example:

curl --request GET --url http://127.0.0.1:9090/ngsi-ld/v1/entities/notavaliduri

Provides:

{
  "type": "https://uri.etsi.org/ngsi-ld/errors/BadRequestData",
  "title": "Bad Request Data.",
  "details": "id is not a URI"
}

With Content-Type set to text/plain;charset=UTF-8

martin-p-bauer commented 2 years ago

You are right - the mime type shall be application/json according to the specification:

5.5.3 Error response payload body

When reporting errors back to clients, NGSI-LD implementations shall generate a JSON object in accordance with IETF RFC 7807 [10], section 3.1, including, at least the following terms:

Even though IETF RFC 7807 [10] defines a specific MIME type for error payloads, NGSI-LD implementations shall use the standard JSON MIME type ("application/json") when reporting errors, so that old clients or existing tools are not broken.

@developing team: please fix!

amitrnec commented 2 years ago

Hi, Currently working on this issue.

Thanks.

amitrnec commented 2 years ago

Hi, We have fixed this issue #313

Thanks.

amitrnec commented 2 years ago

Hi, Now we have merged in Dev branch.

Thanks.