Skip to content

Commit

Permalink
Merge pull request #39 from alexkiro/master
Browse files Browse the repository at this point in the history
Add support for OPTIONS HTTP method.
  • Loading branch information
mmalecki committed Dec 11, 2018
2 parents 0e8f437 + 45a69eb commit de96c9c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -39,6 +39,7 @@ Hock supports the 5 primary HTTP methods at this time:
* DELETE
* HEAD
* COPY
* OPTIONS

```Javascript
// Returns a hock Request object
Expand Down
17 changes: 17 additions & 0 deletions lib/hock.js
Expand Up @@ -242,6 +242,23 @@ Hock.prototype.copy = function (url, body, headers) {
});
};

/**
* Hock.options
*
* @description enqueue a OPTIONS request into the assertion queue
*
* @param {String} url the route of the request to match
* @param {object} [headers] optionally match the request headers
* @returns {Request}
*/
Hock.prototype.options = function (url, headers) {
return new Request(this, {
method: 'OPTIONS',
url: url,
headers: headers || {}
});
};

/**
* Hock.filteringRequestBody
*
Expand Down

0 comments on commit de96c9c

Please sign in to comment.