ResponseImpl<T>.fromHttpResponse constructor

ResponseImpl<T>.fromHttpResponse(
  1. Response response
)

Implementation

factory ResponseImpl.fromHttpResponse(http.Response response) {
  return ResponseImpl._(
      statusCode: response.statusCode,
      headers: response.headers.entries
          .map((entry) => Header(entry.key, entry.value))
          .toSet(),
      bodyString: response.body,
      body: response.body.isNotEmpty ? jsonDecode(response.body) : {},
      uri: response.request!.url,
      reasonPhrase: response.reasonPhrase,
      method: response.request!.method);
}