Created
October 2, 2015 14:00
-
-
Save ruprict/5ac9af6efd18e47ffd79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function deserialize(res) { | |
var header = res.headers.get('Content-Type'); | |
if (!header) return res.text(); | |
return res.headers.get('Content-Type').indexOf('application/json') > -1 ? res.json() : res.text(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment