Skip to content

Commit

Permalink
chore(fetch): add vercel edge support
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mendez committed Apr 26, 2023
1 parent 96410aa commit 4a2d57d
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 16 deletions.
7 changes: 0 additions & 7 deletions .circleci/config.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build and test
on: [push]

concurrency:
group: 'test'
cancel-in-progress: true

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3

- name: Use Node.js Latest
uses: actions/setup-node@v3
with:
node-version: latest

- name: Install dependencies
run: npm i

- name: Test project
run: npm test
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# node-iframe

[![a11ywatch](https://circleci.com/gh/a11ywatch/node-iframe.svg?style=svg)](https://circleci.com/gh/a11ywatch/node-iframe)

create iframes to bypass security issues on your server with node.js can also be used in a browser

## Installation
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-iframe",
"version": "1.9.2",
"version": "1.9.4",
"description": "create iframes on your server to bypass CORS. Reverse engineer security issues.",
"main": "dist/iframe.js",
"scripts": {
Expand Down
19 changes: 15 additions & 4 deletions src/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,21 @@ if (!fetcher) {

(async () => {
if (process) {
const followRedirects = require('follow-redirects');
followRedirects.maxRedirects = 4;
const http = followRedirects.http;
const https = followRedirects.https;
let http;
let https;

// add edge non streaming support
if(process.env.VERCEL_EDGE) {
http = require("http")
https = require("https")
} else {
const followRedirects = require('follow-redirects');

followRedirects.maxRedirects = 4;

http = followRedirects.http;
https = followRedirects.https;
}

const getHttp = (url: string) =>
url.startsWith("https://") ? https : http;
Expand Down

0 comments on commit 4a2d57d

Please sign in to comment.