Skip to content
This repository was archived by the owner on Nov 19, 2023. It is now read-only.

Commit f0c69b0

Browse files
committed
refactor(docs): improve abort description
1 parent 8361f66 commit f0c69b0

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ toxy allows you to plug in [poisons](#poisons), optionally filtered by [rules](#
1010
It operates only at L7 (application level).
1111

1212
toxy can be fluently used [programmatically](#programmatic-api) or via [HTTP API](#http-api).
13-
It was built on top of [rocky](https://github.com/h2non/rocky), a full-featured middleware-oriented HTTP proxy, and it's [pluggable](https://github.com/h2non/toxy/blob/master/examples/express.js) in [connect](https://github.com/senchalabs/connect)/[express](http://expressjs.com) as standard middleware.
13+
It was built on top of [rocky](https://github.com/h2non/rocky), a full-featured middleware-oriented HTTP proxy, and it's also [pluggable](https://github.com/h2non/toxy/blob/master/examples/express.js) in [connect](https://github.com/senchalabs/connect)/[express](http://expressjs.com) as standard middleware.
1414

1515
Requires node.js +0.12 or io.js +1.6
1616

@@ -474,7 +474,7 @@ toxy.poison(toxy.poisons.throttle({ chunk: 2048, threshold: 1000 }))
474474

475475
<table>
476476
<tr>
477-
<td><b>Name</b></td><td>slowClose</td>
477+
<td><b>Name</b></td><td>abort</td>
478478
</tr>
479479
<tr>
480480
<td><b>Poisoning Phase</b></td><td>incoming / outgoing</td>
@@ -489,10 +489,9 @@ Aborts the TCP connection. From the low-level perspective, this will destroy the
489489
**Arguments**:
490490

491491
- **options** `object`
492-
- **error** `Error` - Custom error when destroying the socket. Default to `null`
493-
- **delay** `number` - Abort TCP connection after waiting the given miliseconds . Default to `0`
494-
- **next** `boolean` - If `true`, the connection will be aborted unless the server responds within `delay` milliseconds. Internally, it won't block the middleware call chain, continuing with the next middleware. Default to `false`
495-
492+
- **delay** `number` - Aborts TCP connection after waiting the given miliseconds. Default to `0`
493+
- **next** `boolean` - If `true`, the connection will be aborted if the target server takes more than the `delay` param time to reply. Default to `false`
494+
- **error** `Error` - Custom internal node.js error to use when destroying the socket. Default to `null`
496495

497496
```js
498497
// Basic connection abort

examples/abort.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ proxy
1414
proxy
1515
.all('/delay/*')
1616
// In this case, the socket will be closed if
17-
// the target server doesn't replies with
18-
// a response after 2 seconds
17+
// the target server takes more than
18+
// 2 seconds to respond
1919
.poison(poisons.abort({ delay: 2000, next: true }))
2020
.withRule(rules.method('GET'))
2121

0 commit comments

Comments
 (0)