Skip to content

Commit

Permalink
docs(README): add api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Johnny Estilles committed Apr 30, 2015
1 parent 16dbe09 commit 41740ab
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,43 @@ exports['routeHandler - Simple testing'] = function(test) {
};
```

## API
### .createRequest()

```
httpMocks.createRequest(options)
```

Where options is an object hash with any of the following values:

option | description | default value
------ | ----------- | -------------
`method`| request HTTP method | 'GET'
`url` | request URL | ''
`originalUrl` | request original URL | `url`
`path` | request path | ''
`params` | object hash with params | {}
`session` | object hash with session values | `undefined`
`cookies` | object hash with request cookies | {}
`signedCookies` | object hash with signed cookies | `undefined`
`headers` | object hash with request headers | {}
`body` | object hash with body | {}
`query` | object hash with query values | {}
`files` | object hash with values | {}

### .createResponse()

```js
httpMocks.createResponse(options)
```

Where options is an object hash with any of the following values:

option | description | default value
------ | ----------- | -------------
`eventEmitter` | event emitter used by nmh | `mockEventEmitter`
`writableStream` | writable stream used by nmh | `mockWritableStream`

## Design Decisions

We wanted some simple mocks without a large framework.
Expand Down

0 comments on commit 41740ab

Please sign in to comment.