1
- # Chai HTTP [ ![ semantic-release] ( https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg )] ( https://github.com/semantic-release/semantic-release ) [ ![ NPM version] ( https://img.shields.io/npm/v/chai-http.svg )] ( https://img.shields.io/npm/v/chai-http.svg ) [ ![ Dependency Status ] ( https://img.shields.io/david/chaijs/chai-http.svg )] ( https://img.shields.io/david/chaijs/chai-http.svg ) [ ![ devDependencies ] ( https://david-dm.org/chaijs/chai-http/dev-status.svg )] ( https://david-dm.org/chaijs/chai-http/dev-status.svg )
1
+ # Chai HTTP [ ![ semantic-release] ( https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg )] ( https://github.com/semantic-release/semantic-release ) [ ![ NPM version] ( https://img.shields.io/npm/v/chai-http.svg )] ( https://img.shields.io/npm/v/chai-http.svg )
2
2
3
3
> HTTP integration testing with Chai assertions.
4
4
11
11
12
12
#### Installation
13
13
14
- This is an addon plugin for the [ Chai Assertion Library] ( http ://chaijs.com) . Install via [ npm] ( http ://npmjs.org ) .
14
+ This is an addon plugin for the [ Chai Assertion Library] ( https ://www. chaijs.com/ ) . Install via [ npm] ( https ://www. npmjs.com/ ) .
15
15
16
16
npm install chai-http
17
17
@@ -39,7 +39,7 @@ To use Chai HTTP on a web page, just include the [`dist/chai-http.js`](dist/chai
39
39
## Integration Testing
40
40
41
41
Chai HTTP provides an interface for live integration
42
- testing via [ superagent] ( https://github.com/visionmedia /superagent ) .
42
+ testing via [ superagent] ( https://github.com/ladjs /superagent ) .
43
43
To do this, you must first
44
44
construct a request to an application or url.
45
45
@@ -190,7 +190,7 @@ asynchronously. Therefore, a mechanism must be used to notify the testing
190
190
framework that the callback has completed. Otherwise, the test will pass before
191
191
the assertions are checked.
192
192
193
- For example, in the [ Mocha test framework] ( http ://mochajs.org/) , this is
193
+ For example, in the [ Mocha test framework] ( https ://mochajs.org/ /) , this is
194
194
accomplished using the
195
195
[ ` done ` callback] ( https://mochajs.org/#asynchronous-code ) , which signal that the
196
196
callback has completed, and the assertions can be verified:
@@ -215,7 +215,7 @@ it('succeeds silently!', () => { // <= No done callback
215
215
```
216
216
217
217
When ` done ` is passed in, Mocha will wait until the call to ` done() ` , or until
218
- the [ timeout] ( http ://mochajs.org/#timeouts) expires. ` done ` also accepts an
218
+ the [ timeout] ( https ://mochajs.org/#timeouts) expires. ` done ` also accepts an
219
219
error parameter when signaling completion.
220
220
221
221
#### Dealing with the response - Promises
@@ -301,9 +301,9 @@ If a value is provided, equality to value will be asserted.
301
301
You may also pass a regular expression to check.
302
302
303
303
__ Note:__ When running in a web browser, the
304
- [ same-origin policy] ( https://tools .ietf.org/html/rfc6454#section-3 )
304
+ [ same-origin policy] ( https://datatracker .ietf.org/doc /html/rfc6454#section-3 )
305
305
only allows Chai HTTP to read
306
- [ certain headers] ( https://www.w3. org/TR/cors/#simple-response-header ) ,
306
+ [ certain headers] ( https://fetch.spec.whatwg. org/#http-responses ) ,
307
307
which can cause assertions to fail.
308
308
309
309
``` js
@@ -318,9 +318,9 @@ expect(req).to.have.header('content-type', /^text/);
318
318
Assert that a ` Response ` or ` Request ` object has headers.
319
319
320
320
__ Note:__ When running in a web browser, the
321
- [ same-origin policy] ( https://tools .ietf.org/html/rfc6454#section-3 )
321
+ [ same-origin policy] ( https://datatracker .ietf.org/doc /html/rfc6454#section-3 )
322
322
only allows Chai HTTP to read
323
- [ certain headers] ( https://www.w3. org/TR/cors/#simple-response-header ) ,
323
+ [ certain headers] ( https://fetch.spec.whatwg. org/#http-responses ) ,
324
324
which can cause assertions to fail.
325
325
326
326
``` js
0 commit comments