GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Dancer::RPCPlugin::DefaultRoute(3) User Contributed Perl Documentation Dancer::RPCPlugin::DefaultRoute(3)

Dancer::RPCPlugin::DefaultRoute - Catch bad-requests and send error-response

    use Dancer::RPCPlugin::DefaultRoute;
    setup_default_route();

Implements default endpoint to generate -32601 'method not found' or 'path not found' error_response for non existing endpoints

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'"
    

(c) MMXX - Abe Timmerman <abetim@cpan.org>
2020-08-10 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.