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
452 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/non-existent.json"); // URL does not exist
}).then((response) => {
let parsedJson = getJson.parse(response);
/* throws: BadResponseCode: Got an unexpected HTTP status code (404) */
console.log(parsedJson);
});