-
Notifications
You must be signed in to change notification settings - Fork 67
Supported WebDAV methods
The server provides methods to implements the WebDAV specifications, but it is possible to add your own methods and to override these methods with yours. You can do so thanks to the method method
of the WebDAVServer
instance. You can also manage the behavior of the server when a requested method is not implemented thanks to the method onUnknownMethod
of the WebDAVServer
instance.
Method | Description |
---|---|
NotImplemented |
Default behavior when the requested method is not implemented. It returns a 501 Not implemented to the client. |
Proppatch |
Set/Remove properties to/from a resource. |
Propfind |
Get information about a resource (name, properties, locks, etc...). The content is not parsed yet (making this behavior not completely compliant with the RFC4918). |
Options |
Get the list of supported methods. |
Delete |
Delete a resource. |
Unlock |
Unlock a resource. It needs the Lock-Token header. |
Mkcol |
Create a directory type resource. |
Copy |
Copy a resource. It needs the Destination header. |
Lock |
Lock a resource, preventing it from being written. This method can refresh a lock if the If header is provided. |
Move |
Move a resource. It needs the Destination header. |
Head |
Make a Get but do not send the content. Allow to test if a resource exists and if it can be read. |
Post |
Set the content of a resource or create this one. It is an alias of the Put method. Removing the Put method will keep the Put behavior through the Post method |
Put |
Set the content of a resource or create this one. |
Get |
Get the content of a resource. |
In order to get more information and to get some examples of requests, you can look at the RFC4918 page.
A method must follow the WebDAVRequest
interface :
type ChunkOnDataCallback = (chunk : Buffer, isFirst : boolean, isLast : boolean) => void
type StartChunkedCallback = (error : HTTPError, onData : ChunkOnDataCallback) => void
interface WebDAVRequest
{
(arg : MethodCallArgs, callback : () => void) : void
startChunked ?: (arg : MethodCallArgs, callback : StartChunkedCallback) => void
}
When executed, the callback MUST always be called. This will allow the afterRequest
functions to be executed and finalize the sending to the client.
The (arg : MethodCallArgs, callback : () => void) : void
is the default behavior. It is called when the request is not chunked or if there is no startChunked
method.
The startChunked
method is useful if you expect a large content. It will allow the management of the request content as a stream. This method should check everything it can before calling the callback
. The callback
allow this method to send back an error or a function to call everytime a chunk of data is received. If an error is returned, the onData
function will never be called.
The MethodCallArgs
class is the request/response manager, allowing the method to get information from the request and to send data to the client. It simplify some tasks such as finding a header without case sensitivity.
server.method('INFO', infoMethodExecutor);
This will tell to the server to call the infoMethodExecutor
function (or infoMethodExecutor.startChunked
if available) when it receives a request with the method info
(not case sensitive).
You can find the implementations of the WebDAV methods in here to get some examples.
- Home
- Version 2
- Install
- Quick Start Guide
- Examples
- Concepts
- User concepts
- Server concepts
- Customizing
- Version 1 [Obsolete]
- Install
- Quick Start Guide
- Examples
- Features
- Resource concepts
- User concepts
- Server concepts
- Customizing
- Project