Skip to content

Commit 8673e37

Browse files
authored
Merge pull request #102 from keithamus/fix-promise-docs
docs: fix documentation regarding adding Promises
2 parents 1345021 + 59b5652 commit 8673e37

File tree

5 files changed

+37
-31
lines changed

5 files changed

+37
-31
lines changed

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -178,20 +178,22 @@ chai.request(app)
178178
```
179179

180180
__Note:__ Node.js version 0.10.x and some older web browsers do not have
181-
native promise support. You can use any promise library, such as
182-
[es6-promise](https://github.com/jakearchibald/es6-promise) or
183-
[kriskowal/q](https://github.com/kriskowal/q) and call the `addPromise`
184-
method to use that library with Chai HTTP. For example:
181+
native promise support. You can use any spec compliant library, such as:
182+
- [kriskowal/q](https://github.com/kriskowal/q)
183+
- [stefanpenner/es6-promise](https://github.com/stefanpenner/es6-promise)
184+
- [petkaantonov/bluebird](https://github.com/petkaantonov/bluebird)
185+
- [then/promise](https://github.com/then/promise)
186+
You will need to set the library you use to `global.Promise`, before
187+
requiring in chai-http. For example:
185188

186189
```js
187-
var chai = require('chai');
188-
chai.use(require('chai-http'));
189-
190190
// Add promise support if this does not exist natively.
191191
if (!global.Promise) {
192-
var q = require('q');
193-
chai.request.addPromises(q.Promise);
192+
global.Promise = require('q');
194193
}
194+
var chai = require('chai');
195+
chai.use(require('chai-http'));
196+
195197
```
196198

197199
#### Retaining cookies with each request

dist/chai-http.js

Lines changed: 11 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/chai-http.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/chai-http.min.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/request.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,20 +159,22 @@ var http = require('http')
159159
* ```
160160
*
161161
* __Note:__ Node.js version 0.10.x and some older web browsers do not have
162-
* native promise support. You can use any promise library, such as
163-
* [es6-promise](https://github.com/jakearchibald/es6-promise) or
164-
* [kriskowal/q](https://github.com/kriskowal/q) and call the `addPromise`
165-
* method to use that library with Chai HTTP. For example:
162+
* native promise support. You can use any spec compliant library, such as:
163+
* - [kriskowal/q](https://github.com/kriskowal/q)
164+
* - [stefanpenner/es6-promise](https://github.com/stefanpenner/es6-promise)
165+
* - [petkaantonov/bluebird](https://github.com/petkaantonov/bluebird)
166+
* - [then/promise](https://github.com/then/promise)
167+
* You will need to set the library you use to `global.Promise`, before
168+
* requiring in chai-http. For example:
166169
*
167170
* ```js
168-
* var chai = require('chai');
169-
* chai.use(require('chai-http'));
170-
*
171171
* // Add promise support if this does not exist natively.
172172
* if (!global.Promise) {
173-
* var q = require('q');
174-
* chai.request.addPromises(q.Promise);
173+
* global.Promise = require('q');
175174
* }
175+
* var chai = require('chai');
176+
* chai.use(require('chai-http'));
177+
*
176178
* ```
177179
*
178180
* #### Retaining cookies with each request

0 commit comments

Comments
 (0)