Skip to content

Regional API (Beta) should ignore any spurious Content-Type in GET request #16

Description

@joth76

If a client sends a text/html Content-Type header in the get request (spurious, but not disallowed) then it causes the API to error:

$ curl  --header "Content-Type: text/html" https://api.carbonintensity.org.uk:443/regional/regionid/10
{
"error": {
  "code": "400 Bad Request",
  "message":  "Unsupported Media Type"
  }

This header is correctly ignored in the national API and works finr, it's only the Regional API that appears to choke on it.


$ curl  --header "Content-Type: text/html" https://api.carbonintensity.org.uk/intensity
{
  "data":[{
    "from": "2023-08-31T11:30Z",
    "to": "2023-08-31T12:00Z",
    "intensity": {
      "forecast": 191,
      "actual": 190,
      "index": "moderate"
    }
  }]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions