-
-
08 Dec 2020 07:52:54 UTC
- Distribution: Dancer-Plugin-RPC
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues
- Testers (26 / 0 / 0)
- Kwalitee
Bus factor: 1- % Coverage
- License: perl_5
- Perl: v5.10.1
- Activity
24 month- Tools
- Download (38.7KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
++ed by:2 non-PAUSE users- Dependencies
- Dancer
- JSON
- Params::Validate
- Params::ValidationCompiler
- RPC::XML
- Time::HiRes
- Types::Standard
- YAML
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Dancer::RPCPlugin::DefaultRoute - Catch bad-requests and send error-response
SYNOPSIS
use Dancer::RPCPlugin::DefaultRoute; setup_default_route();
DESCRIPTION
Implements default endpoint to generate -32601 'method not found' or 'path not found' error_response for non existing endpoints
setup_default_route
Installs a Dancer route-handler for
any qr{.+}
which tries to return an appropriate error response to the requestor.Responses
All responeses will have status: 200 OK
The content-type (and body) of the request determine the error-response:
- text/xml
-
If the body is valid XMLRPC, the response is an XMLRPC-fault:
faultCode => -32601 faultString => "Method '%s' not found"
If the body is not valid XMLRPC, the response is an XMLRPC-fault:
faultCode => -32600 faultString => "Invaild xml-rpc. Not configming to spec: $@"
- application/json
-
If the body is valid JSONRPC (ie. is has a 'jsonrpc': '2.0' field/value), the response is a JSONRPC-error:
code => -32601 message => "Method '%s' not found"
If the body is not valid JSONRPC, the response is a generic json struct:
'error': { 'code': -32601, 'message': "Method '$request->path' not found" }
- other/content-type
-
Any other content-type is outside the scope of the service. We can respond in any way we like. For the moment it will be:
status(404) content_type('text/plain') body => "Error! '$request->path' was not found for '$request->content_type'"
COPYRIGHT
(c) MMXX - Abe Timmerman <abetim@cpan.org>
Module Install Instructions
To install Dancer::Plugin::RPC, copy and paste the appropriate command in to your terminal.
cpanm Dancer::Plugin::RPC
perl -MCPAN -e shell install Dancer::Plugin::RPC
For more information on module installation, please visit the detailed CPAN module installation guide.