Closed arjunmenon closed 6 years ago
custom HTTP? can you provide a sample? @arjunmenon
I also have a similar request. What i basically want to understand, is there a way to handle custom http methods? Like in the above example @arjunmenon wants to define a Method.NOTIFY. The server should be able to understand the http method "NOTIFY" and accordingly handle the request. But in the current case and custom method, changes it to Method.OPTIONS. SO kindly help us to understand how to do it.
I think its not possible in previous version which are in maven. Since they are locked in an enum. Wonder why though they have mentioned this in their feature list -
Some built-in support for HEAD, POST and DELETE requests. You can easily implement/customize any HTTP method, though.
The original version of Nanohttps simply checked for String - https://github.com/NanoHttpd/nanohttpd-java-1.1/blob/nanohttpd-for-java1.1/NanoHTTPD.java#L86
A PR was just approved with a quick and dirty addition to the Method enum. In a future version I plan to make this a truly extensible system.
Hey What is a simple example of handling a custom HTTP method? Frankly, there is not much how-to on this and I really want to know.
PS want to handle NOTIFY and SUBSCRIBE HTTP methods and return a 200 OK