higherkindness / mu-haskell

Mu (μ) is a purely functional framework for building micro services.
http://higherkindness.io/mu-haskell/
Apache License 2.0
333 stars 19 forks source link

Error in header lookup ( Server.hs ) #318

Closed FUZASHI closed 2 years ago

FUZASHI commented 3 years ago

https://github.com/higherkindness/mu-haskell/blob/master/graphql/src/Mu/GraphQL/Server.hs

  case lookup hContentType $ requestHeaders req of
    Just "application/json"    ->
      case A.eitherDecode body of
        Left err                             -> toError $ T.pack err
        Right (GraphQLInput qry vars opName) -> execQuery opName vars qry
    Just "application/graphql" ->
      case decodeUtf8' $ toStrict body of
        Left err  -> toError $ "Could not decode utf8 from body: " <> unpackUnicodeException err
        Right msg -> execQuery Nothing HM.empty msg
    _                          -> toError "No `Content-Type` header found!"
_          -> toError "Unsupported method"`

Missing charset parameter case causes {"content-type": "application/json; charset=utf-8"} to fail - ("message":"No Content-Type header found!").