This module extends the Http module with better error handling and more information in the success case.
Named type alias for the Http.task parameter
Convenience function to convert an Ext.Http.Error to a String.
A resolver that does process the response at all. It just returns the response as is, but with Http.Metadata included. And with error type as Ext.Http.Error instead of Http.Error.
Useful for decoding non-json payloads like Bytes or String
Resolver for Http.task that includes proper details in both the error case and metadata in the success case.
Usually metadata is not needed in the success case, just add Task.map .data to your existing code
```diff
Http.task
{ method = "GET"
, headers = []
, url = "https://example.com"
, body = Http.emptyBody
- , resolver = Http.stringResolver (otherJsonResolver myDecoder)
+ , resolver = Http.stringResolver (Ext.Http.jsonResolver myDecoder)
, timeout = Nothing
}
+ |> Task.map .data
```But when you need it, having the metadata available is very useful.
```diff
Http.task
{ method = "GET"
, headers = []
, url = "https://example.com"
, body = Http.emptyBody
, resolver = Http.stringResolver (Ext.Http.jsonResolver myDecoder)
, timeout = Nothing
}
+ |> Task.map (Debug.log "{ meta, data }")
|> Task.map .data
```
Use Ext.Http.Error instead of Http.Error to get more information about the error.