https://github.com/binded/broken-http-server
A broken HTTP server for testing & debugging
https://github.com/binded/broken-http-server
Last synced: over 1 year ago
JSON representation
A broken HTTP server for testing & debugging
- Host: GitHub
- URL: https://github.com/binded/broken-http-server
- Owner: binded
- License: mit
- Created: 2016-09-29T00:01:03.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-09-29T02:41:25.000Z (over 9 years ago)
- Last Synced: 2025-02-18T21:52:12.691Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 47.9 KB
- Stars: 4
- Watchers: 9
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# broken-http-server
[](https://travis-ci.org/blockai/broken-http-server)
A broken HTTP server for testing.

## Install
As a CLI:
```bash
npm install -g broken-http-server
```
As a library:
```bash
npm install --save-dev broken-http-server
```
Requires Node v6+
## Usage
```bash
broken-http-server [port]
```
As a library:
```javascript
import startServer from 'broken-http-server'
startServer()
.then(({ baseURL, close }) => {
console.log(`server listening at ${baseURL}`)
console.log('closing server...')
return close()
}).then(() => {
console.log('server closed')
})
```
See [./test](./test) directory for more usage examples.
## Routes
**GET /abort**
Closes the socket immediately before replying
**GET /content-length-too-small**
Sends `content-length` header which is smaller than the actual body
**GET /content-length-too-large**
Sends `content-length` header which is larger than the actual body
**GET /stop-writing-body-halfway**
Writes about half the body but stops half way without closing the
socket.