|
|
|
@ -55,7 +55,7 @@ export class RemixURLResolver { |
|
|
|
|
// eslint-disable-next-line no-useless-catch
|
|
|
|
|
try { |
|
|
|
|
const req = `https://raw.githubusercontent.com/${root}/${reference}/${filePath}` |
|
|
|
|
const response: AxiosResponse = await axios.get(req) |
|
|
|
|
const response: AxiosResponse = await axios.get(req, { transformResponse: [] }) |
|
|
|
|
return { content: response.data, cleanUrl: root + '/' + filePath } |
|
|
|
|
} catch (e) { |
|
|
|
|
throw e |
|
|
|
@ -70,7 +70,7 @@ export class RemixURLResolver { |
|
|
|
|
async handleHttp (url: string, cleanUrl: string): Promise<HandlerResponse> { |
|
|
|
|
// eslint-disable-next-line no-useless-catch
|
|
|
|
|
try { |
|
|
|
|
const response: AxiosResponse = await axios.get(url) |
|
|
|
|
const response: AxiosResponse = await axios.get(url, { transformResponse: [] }) |
|
|
|
|
return { content: response.data, cleanUrl } |
|
|
|
|
} catch (e) { |
|
|
|
|
throw e |
|
|
|
@ -85,7 +85,7 @@ export class RemixURLResolver { |
|
|
|
|
async handleHttps (url: string, cleanUrl: string): Promise<HandlerResponse> { |
|
|
|
|
// eslint-disable-next-line no-useless-catch
|
|
|
|
|
try { |
|
|
|
|
const response: AxiosResponse = await axios.get(url) |
|
|
|
|
const response: AxiosResponse = await axios.get(url, { transformResponse: [] }) |
|
|
|
|
return { content: response.data, cleanUrl } |
|
|
|
|
} catch (e) { |
|
|
|
|
throw e |
|
|
|
@ -97,7 +97,7 @@ export class RemixURLResolver { |
|
|
|
|
try { |
|
|
|
|
const bzz = new Bzz({ url: this.protocol + '//swarm-gateways.net' }) |
|
|
|
|
const url = bzz.getDownloadURL(cleanUrl, { mode: 'raw' }) |
|
|
|
|
const response: AxiosResponse = await axios.get(url) |
|
|
|
|
const response: AxiosResponse = await axios.get(url, { transformResponse: [] }) |
|
|
|
|
return { content: response.data, cleanUrl } |
|
|
|
|
} catch (e) { |
|
|
|
|
throw e |
|
|
|
@ -116,7 +116,7 @@ export class RemixURLResolver { |
|
|
|
|
const req = 'https://ipfs.remixproject.org/' + url |
|
|
|
|
// If you don't find greeter.sol on ipfs gateway use local
|
|
|
|
|
// const req = 'http://localhost:8080/' + url
|
|
|
|
|
const response: AxiosResponse = await axios.get(req) |
|
|
|
|
const response: AxiosResponse = await axios.get(req, { transformResponse: [] }) |
|
|
|
|
return { content: response.data, cleanUrl: url.replace('ipfs/', '') } |
|
|
|
|
} catch (e) { |
|
|
|
|
throw e |
|
|
|
@ -131,7 +131,7 @@ export class RemixURLResolver { |
|
|
|
|
// eslint-disable-next-line no-useless-catch
|
|
|
|
|
try { |
|
|
|
|
const req = 'https://unpkg.com/' + url |
|
|
|
|
const response: AxiosResponse = await axios.get(req) |
|
|
|
|
const response: AxiosResponse = await axios.get(req, { transformResponse: [] }) |
|
|
|
|
return { content: response.data, cleanUrl: url } |
|
|
|
|
} catch (e) { |
|
|
|
|
throw e |
|
|
|
|