Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

Commit

Permalink
Added support for more HTTP methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
jarrodek committed Apr 24, 2016
1 parent 11e7f16 commit 03f0dc8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app.request.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,14 @@ class ArcRequest {
* @param {String} method A method to set.
*/
set method(method) {
if (method) {
method = method.trim();
}
if (!HttpParser.isValidHTTPToken(method)) {
throw new Error(`"${method} is not a valid HTTP method.`);
throw new Error(`"${method}" is not a valid HTTP method.`);
}
if (HttpParser.isForbiddenMethod(method)) {
throw new Error(`"${method} HTTP method is unsupported.`);
throw new Error(`"${method}" HTTP method is unsupported.`);
}
this._method = method.toUpperCase();
this._payloadRequest = ['GET', 'HEADER'].indexOf(this._method) === -1;
Expand Down

0 comments on commit 03f0dc8

Please sign in to comment.