[Pkg-javascript-commits] [node-mocks-http] 214/296: docs(README): add api docs
Thorsten Alteholz
alteholz at moszumanska.debian.org
Mon Feb 8 18:13:38 UTC 2016
This is an automated email from the git hooks/post-receive script.
alteholz pushed a commit to branch master
in repository node-mocks-http.
commit 41740ab8f2ff55df94accef498a23139cd0303c7
Author: Johnny Estilles <johnny.estilles at agentia.asia>
Date: Thu Apr 30 10:56:46 2015 +0800
docs(README): add api docs
---
README.md | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/README.md b/README.md
index a94b091..6702db0 100644
--- a/README.md
+++ b/README.md
@@ -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.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-mocks-http.git
More information about the Pkg-javascript-commits
mailing list