-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: unexpected http method #1651
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm to just early reject headers we don't intend to support. Although can you double check that this works client apps e.g. blockexplorer and webwallet? I think CORS require OPTIONS
requests.
If we require OPTIONS
also check that MethodParamFilter
plug can handle it.
Looking good, maybe just rename the plug so it's consistent with |
Changed my mind as @mederic-p mentioned separately that our routes should already take care of the unsupported methods. So we only need to update the existing MethodParamFilter plug to handle unknown methods. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amazingly amazing
Closes #1646
Overview
Adds one more clause to
MethodParamsFilter
to capture other HTTP methods.Changes
def call(conn, _), do: conn
toOMG.WatcherRPC.Web.Plugs.MethodParamFilter
def call(conn, _), do: conn
toOMG.ChildChainRPC.Web.Plugs.MethodParamFilter
Testing
Runs unit tests or curl as follows:
Watcher
curl -X PUT http://localhost:7434/status.get -H "Content-Length: 0" | jq .
curl -X POST http://localhost:7434/status.get -H "Content-Length: 0" | jq .
Childchain
curl -X PUT http://localhost:9656/alarm.get -H "Content-Length: 0" | jq .
curl -X GET http://localhost:9656/alarm.get -H "Content-Length: 0" | jq .