You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class App {
@Controller
public static class Control {
@Post(value = "/example/bug", consumes = MediaType.ALL)
public Object ep(@Body Object body) {
return body;
}
}
public static void main(String[] args) {
Micronaut.run(App.class, args);
}
}
Run and curl:
curl localhost:8080/example/bug --data 'foobar'
Returns:
{"message":"Required Body [Object body] not specified","path":"/body","_links":{"self":{"href":"/example/bug","templated":false}}}
Expected Behaviour
The request should routed to the defined endpoint when the body can be mapped to the desired type. Here it is Object, but String and byte[] should also work.
I should not have to pass -H "Content-Type: */*" in my curl to get the response.
Actual Behaviour
Call is not routed to the desired endpoint.
I have to set the content-type of the request to */* to get it routed to the handler and get the desired response:
The text was updated successfully, but these errors were encountered:
jameskleeh
changed the title
Route not matched for consumes=MediaType.ALL endpoints
Body argument missing for consumes=MediaType.ALL endpoints
Nov 13, 2019
Steps to Reproduce
Returns:
Expected Behaviour
The request should routed to the defined endpoint when the body can be mapped to the desired type. Here it is
Object
, butString
andbyte[]
should also work.I should not have to pass
-H "Content-Type: */*"
in my curl to get the response.Actual Behaviour
Call is not routed to the desired endpoint.
I have to set the content-type of the request to
*/*
to get it routed to the handler and get the desired response:Environment Information
The text was updated successfully, but these errors were encountered: