@bbc/http-transport
Advanced tools
Comparing version 0.0.2 to 0.0.3
'use strict'; | ||
const DEFAULT_TIMEOUT = 1000; | ||
const DEFAULT_TIMEOUT = 2000; | ||
@@ -5,0 +5,0 @@ class Request { |
{ | ||
"name": "@bbc/http-transport", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A flexible, modular REST client built for ease-of-use and resilience.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -360,2 +360,19 @@ const _ = require('lodash'); | ||
describe('timeout', () => { | ||
it('sets the a timeout', () => { | ||
nock.cleanAll(); | ||
api.get('/') | ||
.socketDelay(1000) | ||
.reply(200, simpleResponseBody); | ||
const client = HttpTransport.createClient(); | ||
const response = client | ||
.get(url) | ||
.timeout(20) | ||
.asBody(); | ||
return assertFailure(response, 'Request failed for GET http://www.example.com/: ESOCKETTIMEDOUT'); | ||
}); | ||
}); | ||
describe('plugins', () => { | ||
@@ -495,19 +512,2 @@ it('supports a per request plugin', () => { | ||
describe('timeout', () => { | ||
it('sets the a timeout', () => { | ||
nock.cleanAll(); | ||
api.get('/') | ||
.socketDelay(1000) | ||
.reply(200, simpleResponseBody); | ||
const client = HttpTransport.createClient(); | ||
const response = client | ||
.get(url) | ||
.timeout(20) | ||
.asBody(); | ||
return assertFailure(response, 'Request failed for GET http://www.example.com/: ESOCKETTIMEDOUT'); | ||
}); | ||
}); | ||
describe('logging', () => { | ||
@@ -514,0 +514,0 @@ it('logs each request at info level when a logger is passed in', () => { |
@@ -162,3 +162,3 @@ const assert = require('chai').assert; | ||
api.get('/') | ||
.socketDelay(1500) | ||
.socketDelay(2500) | ||
.reply(200, simpleResponseBody); | ||
@@ -165,0 +165,0 @@ |
318141