Here's an example of how to create a basic HTTP server in Ruby using the WEBrick
module that responds to PATCH requests:
main.rb355 chars19 lines
This creates a server listening on port 8000 that will respond to PATCH requests to the /patch
endpoint. The implementation of the PATCH request would go in the block provided to mount_proc
. In this example, it simply returns a response of 'Patch request received' with a 200 status code when a PATCH request is received. Otherwise, a 405 status code is returned.
gistlibby LogSnag