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

HttpMethod.custom doesn't work, Unsupported HTTP method #954

Closed
didlich opened this issue Mar 10, 2017 · 6 comments
Closed

HttpMethod.custom doesn't work, Unsupported HTTP method #954

didlich opened this issue Mar 10, 2017 · 6 comments
Labels
help wanted Identifies issues that the core team will likely not have time to work on t:core Issues related to the akka-http-core module t:docs Issues related to the documentation
Milestone

Comments

@didlich
Copy link

didlich commented Mar 10, 2017

I need to extend the http methods, so I used HttpMethod.custom to register my own http method.

val BOLT = HttpMethod.custom(
"BOLT", 
safe = false, 
idempotent = true, 
requestEntityAcceptance = Expected
)

It shows me the message:

Illegal request, responding with status '501 Not Implemented': Unsupported HTTP method: BOLT

I prepared a working Scala/Akka app in this repo, which shows the problem:
https://github.com/didlich/akka-http-custom-method

@jrudolph jrudolph added 0 - new Ticket is unclear on it's purpose or if it is valid or not 1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted t:core Issues related to the akka-http-core module t:docs Issues related to the documentation and removed 0 - new Ticket is unclear on it's purpose or if it is valid or not labels Mar 13, 2017
@jrudolph
Copy link
Member

@didlich custom HttpMethods need to be registered in ParserSettings to apply. Basically the same procedure as shown in the documentation for status codes needs to be used to register a custom http method. You need to change one line to

val parserSettings = ParserSettings(system).withCustomMethods(BOLT)
[...]

It seems this haven't yet been documented properly, so let's keep this ticket open to improve the documentation.

@jrudolph jrudolph added the help wanted Identifies issues that the core team will likely not have time to work on label Mar 13, 2017
@ktoso
Copy link
Member

ktoso commented Mar 13, 2017

We have it documented here: http://doc.akka.io/docs/akka-http/10.0.4/scala/http/routing-dsl/directives/method-directives/extractMethod.html#custom-http-method

So either linking or duplicating the example in that part of the docs would be a good idea it seems

PR very welcome to clean this up!

@didlich
Copy link
Author

didlich commented Mar 13, 2017

@jrudolph, @ktoso thanks for the hint, google was not able to find the proper text in the doc :-)

@ktoso ktoso added this to the 10.0.6 milestone Mar 17, 2017
@richardimaoka
Copy link
Contributor

I can work on this if @didlich is not submitting a Pull Request?

@ktoso
Copy link
Member

ktoso commented Mar 28, 2017

Yes please Richard :-)

richardimaoka added a commit to richardimaoka/akka-http that referenced this issue Mar 29, 2017
richardimaoka added a commit to richardimaoka/akka-http that referenced this issue Mar 29, 2017
@ktoso ktoso removed the 1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted label Mar 30, 2017
@ktoso ktoso closed this as completed Mar 30, 2017
@ktoso
Copy link
Member

ktoso commented Mar 30, 2017

Thanks a ton @richard-imaoka !

tomrf1 pushed a commit to tomrf1/akka-http that referenced this issue Aug 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Identifies issues that the core team will likely not have time to work on t:core Issues related to the akka-http-core module t:docs Issues related to the documentation
Projects
None yet
Development

No branches or pull requests

4 participants