Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom handler #478

Closed
arjunmenon opened this issue Jan 29, 2018 · 4 comments
Closed

Custom handler #478

arjunmenon opened this issue Jan 29, 2018 · 4 comments

Comments

@arjunmenon
Copy link
Contributor

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

@pathikdevani
Copy link

custom HTTP? can you provide a sample? @arjunmenon

@Debjyotinath
Copy link

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.

@arjunmenon
Copy link
Contributor Author

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

@LordFokas
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants