Skip to content

Commit 93b3751

Browse files
author
James Vidler
authored
Merge pull request #61 from agility/joel
updated to work in browser in angular
2 parents 276c4f8 + d2fe0d3 commit 93b3751

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@agility/content-fetch",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "JavaScript library for the Agility Fetch API (node and browser)",
55
"main": "dist/agility-content-fetch.node.js",
66
"scripts": {

src/api-client.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,22 @@ export default function createClient(userConfig) {
105105

106106
const https= require("https")
107107

108-
//create apply the adapter to our axios instance
109-
const api = axios.create({
110-
httpsAgent: new https.Agent({
111-
rejectUnauthorized: false
112-
}),
113-
adapter: adapter,
114-
})
108+
let api = null;
109+
110+
if (https.Agent) {
111+
//create apply the adapter to our axios instance
112+
api = axios.create({
113+
httpsAgent: new https.Agent({
114+
rejectUnauthorized: false
115+
}),
116+
adapter: adapter,
117+
})
118+
} else {
119+
//we can't use the https.Agent
120+
api = axios.create({
121+
adapter: adapter,
122+
})
123+
}
115124

116125

117126

0 commit comments

Comments
 (0)