Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/binded/broken-http-server
A broken HTTP server for testing & debugging
https://github.com/binded/broken-http-server
Last synced: about 4 hours 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 (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-09-29T02:41:25.000Z (about 8 years ago)
- Last Synced: 2024-11-14T16:54:38.319Z (3 days 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
[![Build Status](https://travis-ci.org/blockai/broken-http-server.svg?branch=master)](https://travis-ci.org/blockai/broken-http-server)
A broken HTTP server for testing.
![cli-gif](./stop-writing-body-halfway.gif)
## 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.