Registering custom protocol in Electron to accept post requests?

Viewed 324

Is it possible to register custom protocol in Electron, for example md-file://upload that when my component in view will send a POST request I will able to handle it, get request.body object, process it, and return the HTTP response object?

For example I registering my custom protocol as following:

  protocol.registerStringProtocol("md-file", function (request, callback){
    console.log("md-file", request);
    callback({
       data: '1231231'
    });
  })

It works but I don't see any body or Form Data in the request object, and I can't find in the documentation do I suppose to get those objects and I'm doing something wrong or it's the bug.

1 Answers
Related