Skip to content

Commit

Permalink
fix(proxy): don't use responseTimeout as timeout for all requests (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
flotwig authored Jul 6, 2020
1 parent 59235e4 commit f7917a4
Show file tree
Hide file tree
Showing 12 changed files with 284 additions and 240 deletions.
1 change: 0 additions & 1 deletion packages/proxy/lib/http/request-middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ const MaybeSetBasicAuthHeaders: RequestMiddleware = function () {

const SendRequestOutgoing: RequestMiddleware = function () {
const requestOptions = {
timeout: this.config.responseTimeout,
strictSSL: false,
followRedirect: false,
retryIntervals: [0, 100, 200, 200],
Expand Down

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions packages/server/lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,8 @@ class Server {

logger.setSettings(config)

// generate our request instance
// and set the responseTimeout
// TODO: might not be needed anymore
this._request = Request({ timeout: config.responseTimeout })
// TODO: does not need to be an instance anymore
this._request = Request()
this._nodeProxy = httpProxy.createProxyServer()

const getRemoteState = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const bodyParser = require('body-parser')
const cookieParser = require('cookie-parser')
const e2e = require('../support/helpers/e2e').default
import bodyParser from 'body-parser'
import cookieParser from 'cookie-parser'
import e2e from '../support/helpers/e2e'

let counts = null

Expand Down Expand Up @@ -79,6 +79,13 @@ const onServer2 = function (app) {
const onServer = function (app) {
app.use(cookieParser())

app.get('/timeout', (req, res) => {
setTimeout(() => {
res.set('Access-Control-Allow-Origin', '*')
.end('it worked')
}, req.query.ms)
})

app.get('/cookies*', (req, res) => {
return res.json(req.cookies)
})
Expand All @@ -87,7 +94,7 @@ const onServer = function (app) {
return res.json(counts)
})

return app.get('*', (req, res) => {
app.get('*', (req, res) => {
const host = req.get('host')

counts[host] += 1
Expand Down Expand Up @@ -161,21 +168,24 @@ describe('e2e requests', () => {
})

e2e.it('passes', {
spec: 'request_spec.coffee',
spec: 'request_spec.js',
snapshot: true,
config: {
responseTimeout: 1000,
},
})

it('fails when network immediately fails', function () {
return e2e.exec(this, {
spec: 'request_http_network_error_failing_spec.coffee',
spec: 'request_http_network_error_failing_spec.js',
snapshot: true,
expectedExitCode: 1,
})
})

it('fails on status code', function () {
return e2e.exec(this, {
spec: 'request_status_code_failing_spec.coffee',
spec: 'request_status_code_failing_spec.js',
snapshot: true,
expectedExitCode: 1,
onStdout (stdout) {
Expand All @@ -189,7 +199,7 @@ describe('e2e requests', () => {

it('prints long http props on fail', function () {
return e2e.exec(this, {
spec: 'request_long_http_props_failing_spec.coffee',
spec: 'request_long_http_props_failing_spec.js',
snapshot: true,
expectedExitCode: 1,
onStdout (stdout) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('when network connection cannot be established', () => {
it('fails', () => {
cy.request('http://localhost:16795')
})
})

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
describe('when status code isnt 2xx or 3xx', () => {
it('fails', () => {
cy.request(`http://localhost:2294/myreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallylong\
`)
})
})

This file was deleted.

Loading

8 comments on commit f7917a4

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f7917a4 Jul 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/linux-x64/circle-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-386658/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/circle-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-386628/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f7917a4 Jul 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 ia32 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

Instructions are included below, depending on the shell you are using.

In Command Prompt (cmd.exe):

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-ia32/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33933675/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33933675/cypress.tgz

In PowerShell:

$env:CYPRESS_INSTALL_BINARY = https://cdn.cypress.io/beta/binary/5.0.0/win32-ia32/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33933675/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33933675/cypress.tgz

In Git Bash:

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-ia32/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33933675/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33933675/cypress.tgz

Using cross-env:

If the above commands do not work for you, you can also try using cross-env:

npm i -g cross-env
cross-env CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-ia32/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33933675/cypress.zip npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33933675/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f7917a4 Jul 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

Instructions are included below, depending on the shell you are using.

In Command Prompt (cmd.exe):

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-x64/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33933675/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33933675/cypress.tgz

In PowerShell:

$env:CYPRESS_INSTALL_BINARY = https://cdn.cypress.io/beta/binary/5.0.0/win32-x64/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33933675/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33933675/cypress.tgz

In Git Bash:

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-x64/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33933675/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33933675/cypress.tgz

Using cross-env:

If the above commands do not work for you, you can also try using cross-env:

npm i -g cross-env
cross-env CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/win32-x64/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33933675/cypress.zip npm install https://cdn.cypress.io/beta/npm/5.0.0/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33933675/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f7917a4 Jul 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.0/darwin-x64/circle-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-386915/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.0/circle-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-386685/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f7917a4 Jul 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.10.0/linux-x64/circle-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-386988/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.10.0/circle-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-386968/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f7917a4 Jul 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 ia32 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

Instructions are included below, depending on the shell you are using.

In Command Prompt (cmd.exe):

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.10.0/win32-ia32/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33938234/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.10.0/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33938234/cypress.tgz

In PowerShell:

$env:CYPRESS_INSTALL_BINARY = https://cdn.cypress.io/beta/binary/4.10.0/win32-ia32/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33938234/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.10.0/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33938234/cypress.tgz

In Git Bash:

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.10.0/win32-ia32/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33938234/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.10.0/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33938234/cypress.tgz

Using cross-env:

If the above commands do not work for you, you can also try using cross-env:

npm i -g cross-env
cross-env CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.10.0/win32-ia32/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33938234/cypress.zip npm install https://cdn.cypress.io/beta/npm/4.10.0/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33938234/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f7917a4 Jul 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

Instructions are included below, depending on the shell you are using.

In Command Prompt (cmd.exe):

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.10.0/win32-x64/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33938234/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.10.0/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33938234/cypress.tgz

In PowerShell:

$env:CYPRESS_INSTALL_BINARY = https://cdn.cypress.io/beta/binary/4.10.0/win32-x64/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33938234/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.10.0/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33938234/cypress.tgz

In Git Bash:

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.10.0/win32-x64/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33938234/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.10.0/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33938234/cypress.tgz

Using cross-env:

If the above commands do not work for you, you can also try using cross-env:

npm i -g cross-env
cross-env CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.10.0/win32-x64/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33938234/cypress.zip npm install https://cdn.cypress.io/beta/npm/4.10.0/appveyor-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-33938234/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on f7917a4 Jul 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/4.10.0/darwin-x64/circle-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-387002/cypress.zip
npm install https://cdn.cypress.io/beta/npm/4.10.0/circle-develop-f7917a4c5ba91ce05b1354797a1743c3c25062b6-386993/cypress.tgz

Please sign in to comment.