Skip to content

Commit d7c4d51

Browse files
authored
Merge branch 'master' into add-client-tests-for-content-type
2 parents 4a4a9f3 + 86e7cc5 commit d7c4d51

File tree

7 files changed

+19
-20
lines changed

7 files changed

+19
-20
lines changed

.travis.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1+
sudo: false
12
language: node_js
23
node_js:
34
- '4.7'
45
- '6.9'
5-
env:
6-
- CXX=g++-4.8
7-
addons:
8-
apt:
9-
sources:
10-
- ubuntu-toolchain-r-test
11-
packages:
12-
- g++-4.8
6+
cache:
7+
directories:
8+
- node_modules
139
branches:
1410
only:
1511
- master
1612
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
13+
before_script: "npm update"
1714
before_deploy: "npm run build"
1815
deploy:
1916
provider: npm

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ This lib exposes these functionalities:
6464
HTTP Client
6565
-----------
6666

67-
`Swagger.http(req)` exposes a [Fetch-like interface](https://github.com/matthew-andrews/isomorphic-fetch) with a twist: allowing `url` in the request object so that it can be passed around and mutated. It extends Fetch to support request and response interceptors and performs response & header serialization. This method could be overridden to change how SwaggerJS performs HTTP requests.
67+
`Swagger.http(req)` exposes a [Fetch-like interface](https://github.com/lquixada/cross-fetch) with a twist: allowing `url` in the request object so that it can be passed around and mutated. It extends Fetch to support request and response interceptors and performs response & header serialization. This method could be overridden to change how SwaggerJS performs HTTP requests.
6868

6969
```js
7070
// Fetch-like, but support `url`, `query` and `xxxInterceptor`
@@ -279,6 +279,7 @@ npm run test # run test
279279
npm run test:watch # run test with change watching
280280
npm run lint # run lint
281281
npm run build # package to release
282+
npm run build-dev # package with non-minified dist/index.js (for debugging)
282283
npm run build-bundle # build browser version available at .../browser
283284
```
284285

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
},
1818
"scripts": {
1919
"build": "cross-env NODE_ENV=production webpack -p --config ./webpack.config.js",
20+
"build-dev": "cross-env NODE_ENV=development webpack --config ./webpack.config.js",
2021
"build-bundle": "cross-env NODE_ENV=production webpack -p --config ./webpack.bundle.config.js",
2122
"watch": "webpack --config webpack.config.js --watch --progress",
2223
"test": "npm run just-test && npm run lint",
@@ -64,12 +65,12 @@
6465
"babel-runtime": "^6.23.0",
6566
"btoa": "1.1.2",
6667
"cookie": "^0.3.1",
68+
"cross-fetch": "0.0.8",
6769
"deep-extend": "^0.4.1",
6870
"fast-json-patch": "1.1.8",
69-
"isomorphic-fetch": "2.2.1",
7071
"isomorphic-form-data": "0.0.1",
7172
"js-yaml": "^3.8.1",
72-
"lodash": "4.16.2",
73+
"lodash": "^4.16.2",
7374
"qs": "^6.3.0",
7475
"url": "^0.11.0"
7576
}

src/http.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'isomorphic-fetch'
1+
import 'cross-fetch/polyfill'
22
import qs from 'qs'
33
import jsYaml from 'js-yaml'
44
import isString from 'lodash/isString'

src/specmap/lib/refs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import fetch from 'isomorphic-fetch'
1+
import {fetch} from 'cross-fetch'
22
import url from 'url'
33
import lib from '../lib'
44
import createError from '../lib/create-error'

test/http.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ describe('http', () => {
105105
describe('serializeHeaders', function () {
106106
it('should handle FetchAPI Headers object, which is iterable', function () {
107107
// Given
108-
// isomorphic-fetch exposes FetchAPI methods onto global
109-
require('isomorphic-fetch')
108+
// cross-fetch exposes FetchAPI methods onto global
109+
require('cross-fetch/polyfill')
110110
expect(global.Headers).toBeA(Function)
111111
const headers = new Headers() // eslint-disable-line no-undef
112112
headers.append('Authorization', 'Basic hoop-la')
@@ -124,8 +124,8 @@ describe('http', () => {
124124

125125
it('should handle two of the same headers', function () {
126126
// Given
127-
// isomorphic-fetch exposes FetchAPI methods onto global
128-
require('isomorphic-fetch')
127+
// cross-fetch exposes FetchAPI methods onto global
128+
require('cross-fetch/polyfill')
129129
expect(global.Headers).toBeA(Function)
130130
const headers = new Headers() // eslint-disable-line no-undef
131131
headers.append('Authorization', 'Basic hoop-la')
@@ -142,8 +142,8 @@ describe('http', () => {
142142

143143
it('should handle multiple headers', function () {
144144
// Given
145-
// isomorphic-fetch exposes FetchAPI methods onto global
146-
require('isomorphic-fetch')
145+
// cross-fetch exposes FetchAPI methods onto global
146+
require('cross-fetch/polyfill')
147147
expect(global.Headers).toBeA(Function)
148148
const headers = new Headers() // eslint-disable-line no-undef
149149
headers.append('Authorization', 'Basic hoop-la')

test/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ describe('constructor', () => {
180180

181181
it('should serialize the response', function () {
182182
// Given
183-
require('isomorphic-fetch') // To ensure global.Headers
183+
require('cross-fetch/polyfill') // To ensure global.Headers
184184
const xapp = xmock().get('https://swagger.io/one', function (req, res, next) {
185185
res.set('hi', 'ho')
186186
return res.send({me: true})

0 commit comments

Comments
 (0)