Let us assume I have successfully installed a client-side extension that 
has the following code-fragment:

                            var settings = {
                               url : '/nbu/upload',
                               processData : false,
                               type : "PUT",
                               dataType: "json",
                               data: JSON.stringify(data),
                               contentType: 'application/json',
                               success: function(data) {
           
                                   // display feedback to user

                                    var feedback = '<div 
class="commit-feedback alert alert-success alert-dismissible" role="alert"> 
\
                                                     <button type="button" 
class="close" data-dismiss="alert" aria-label="Close"><span 
aria-hidden="true">&times;</span></button> \
                                                     '+data.statusText+' \
                                                      \
                                                   </div>';
           
                                   // display feedback
                                   //$('.commit-feedback').remove();
                                   container.prepend(feedback);
                               },
                               error: function(data) {
           
                                   // display feedback to user
                                   var feedback = '<div 
class="commit-feedback alert alert-danger alert-dismissible" role="alert"> \
                                                     <button type="button" 
class="close" data-dismiss="alert" aria-label="Close"><span 
aria-hidden="true">&times;</span></button> \
                                                    
 <strong>Warning!</strong> Something went wrong. \
                                                     
<div>'+data.statusText+'</div> 
\
                                                   </div>';
           
                                   // display feedback
                                   //$('.commit-feedback').remove();
                                   container.prepend(feedback);
                               }
                           }

                            // commit and push
                           utils.ajax(settings);

This extension works fine (notice the use of 'utils.ajax' to call the 
server to include the XSRF tokens)

On the server-side, I have:
from .handlers import setup_handlers

def load_jupyter_server_extension(nbapp):
    setup_handlers(nbapp.web_app)

and
def setup_handlers(web_app):
    route_pattern = ujoin(web_app.settings['base_url'], '/nbu/upload')
    web_app.add_handlers('.*$', [
        (route_pattern, NbuFileHandler)
    ])

Everything installs correctly - however I'm getting a 'PUT 
http://localhost:8888/nbu/upload 405 (Method Not Allowed)' error when the 
ajax call runs.

Any idea why?

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jupyter+unsubscr...@googlegroups.com.
To post to this group, send email to jupyter@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/6f9712d3-e791-41ab-976c-325ba164d3b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to