Reputation: 20720
According to the void setRequestMethod (String method)
documentation here:
The allowed methods are limited to:
I have a server offering access to a list of messages and one of the options I have is to retrieve the next message:
NEXT /api/1/message
However, when I try to put NEXT
as the method in the JavaScript HttpURLConnection I get an error:
E/MsgProcessingService: Failed while handling a message: java.net.ProtocolException: Unknown method 'NEXT'; must be one of [OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE]
Is there a non-hacky way to bypass that method limitation?
Obviously, I can create a new access point as follow on my server, but I was hoping I would not have to do that...
GET /api/1/message/next
Upvotes: 2
Views: 453
Reputation: 6516
No.
Those "methods" are defined in the HTTP spec. This method checks the String against a constant array.
As the spec says, these methods can be expanded, but it's very rare. The Heroku docs discuss this.
Related:
Upvotes: 5