Graphcool / graphcool-framework

Apache License 2.0
1.77k stars 131 forks source link

Incorrect Content-Type for File endpoint response ? #515

Open bre7 opened 6 years ago

bre7 commented 6 years ago

Current behavior

curl -X POST 'https://api.graph.cool/file/v1/123abc' -F "data=@example.png;filename=myname.png"

Currently returns:

HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Content-Length: xxx

{
  "secret": "__SECRET__",
  "name": "myname.png",
  "size": 11111,
  "url": "https://files.graph.cool/__PROJECT_ID__/__SECRET__",
  "id": "abcd",
  "contentType": "image/png"
}

:x: Content-Type is text/plain.

Reproduction

Follow any of the described methods to POST a file using the API, as described in https://www.graph.cool/docs/reference/graphql-api/file-management-eer4wiang0/#using-plain-http

Expected behavior?

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: xxx

{
  "secret": "__SECRET__",
  "name": "myname.png",
  "size": 11111,
  "url": "https://files.graph.cool/__PROJECT_ID__/__SECRET__",
  "id": "abcd",
  "contentType": "image/png"
}

:heavy_check_mark: Content-Type should be application/json.