UNPKG

analytics-react-native

Version:

A React Native client for [Segment](https://segment.com) — The hassle-free way to integrate analytics into any application.

26 lines (21 loc) 502 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = parseResponse; function parseResponse(res) { return res.text().then(function (resText) { var response = res; if (!response.ok) { var error = new Error(response.statusText); error.status = response.status; throw error; } try { response.bodyParsed = JSON.parse(resText); } catch (e) { response.bodyParsed = resText; } return response; }); }