You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
441 B
JavaScript

"use strict";
const axios = require("axios");
const Promise = require("bluebird");
const getJson = require(".");
let manualAxios = axios.create(getJson.axiosConfiguration);
Promise.try(() => {
return manualAxios.get("http://cryto.net/invalid.json"); // {"hello": "world"
}).then((response) => {
let parsedJson = getJson.parse(response);
/* throws: ParsingFailed: Could not parse response body as JSON */
console.log(parsedJson);
});