Currently http-console uses a regular expression to determine if the
user enters a valid HTTP method. This patch replaces that regular
expression with a function call, a function that dynamically builds
that regular expression. The benefit to this approach is that is
allows us to more easily add support for additional methods
(e.g. TRACE) while avoiding potential merge conflicts, as each HTTP
method appears on a separate line instead of the single line of the
original regular expression.
This new function only understands the HTTP methods that were part of
the original regular expression. The inclusion of new methods will
follow this refactoring.
Credit for this change properly belongs to László Bácsi
<email@example.com> who submitted a pull request to the http-console
GitHub repository that adds support for PATCH. The only change I made
to his commit is to make PATCH a part of the new isHTTPMethod()
function instead of adding it to the old regular expression.