私はNetwork.Wreq、Control.Lensを使用しています、Data.Aeson例外:JSONErrorアプリケーション/ random.v4 + JSON "" "レスポンスのコンテンツタイプがである" #Haskell
getInfo = do
let opts = defaults && header "Accept" .~ ["application/random.v4+json"] "Content-Type" .~ ["application/json"]
resp <- asJSON =<< getWith opts "url" :: IO (Response (Map String Value))
let respBody = resp ^. responseBody
return respBody
応答がContent-Type → application/random.v4+json
を持っています
私は関数を呼び出すときに私が代わりにいくつかの空想を持っていることの応答シンプルContent-Type → application/json
を持っているAPIへの呼び出しを行うとき、それは
Exception: JSONError "content type of response is \"application/random.v4+json\""
を言って例外をスローしかし、
私の機能はすべて期待どおりです。 contenty-type
がapplication/json
以外に変更されると、上記のエラーが表示されます。
なぜ例外がスローされますか?私のAPIのすべてのバージョンでどのように動作させることができますか?
**注:両方のバージョンのAPIでは、同じ種類のデータが返されます。