POST with OR WITHOUT a request payload

355 views
Skip to first unread message

D E

unread,
Jun 2, 2022, 9:18:59 AM6/2/22
to WildFly
Using Wildfly 26.1.1.Final with OpenJDK 11.

We have a requirement to allow POST with OR WITHOUT a request payload.  We have the following...

  @POST
  @Path("mypath)
  Response doit (
      @PathParam("foo") Double foo,
      @PathParam("bar") Double bar,
      MyPayload myPayload);


...however, when there is no request payload, there is a  SEVERE message...

2022-05-23 16:05:49,220 SEVERE [org.eclipse.yasson.internal.Unmarshaller] (default task-675) Invalid token=EOF at (line no=1, column no=0, offset=-1). Expected tokens are: [CURLYOPEN, SQUAREOPEN, STRING, NUMBER, TRUE, FALSE, NULL]

What is the correct way of handling this?

James Perkins

unread,
Jun 3, 2022, 7:46:07 PM6/3/22
to WildFly
By "request payload" do you mean no entity passed?

I tested with a very simple endpoint and it seems to be working fine for me if I don't pass a body to the post request.

James Perkins

unread,
Jun 3, 2022, 8:06:27 PM6/3/22
to WildFly
Sorry, I was looking at the wrong console. I also see this error being logged. I think I would consider this a bug since RESTEasy does seem to allow null values. I'm not sure exactly how it could be fixed, but I would consider it a bug :) Please feel free to file a JIRA at https://issues.redhat.com/browse/RESTEASY.

D E

unread,
Jun 6, 2022, 8:45:09 AM6/6/22
to WildFly
Reply all
Reply to author
Forward
0 new messages