Export to GitHub

mockwebserver - issue #3

Illegal argument exception with jersey-client post request with empty body


Posted on Aug 10, 2012 by Quick Rabbit

What steps will reproduce the problem?

  1. Set up mockwebserver and enqueue a request server.enqueue(new MockResponse(...)); server.play();
  2. Create a jersey-client and make a post without a body: client.resource(server.getURL("/")).path("/").post(MyResponseType.class)

What is the expected output? What do you see instead?

I get an IllegalArgumentException from MockWebServer.java, readRequest() method.

What version of the product are you using? On what operating system?

The only public release.

Please provide any additional information below.

MockWebServer checks for a non-empty POST body and fails if empty. Should this be the right behaviour? Curl seems to allow POST's without body (or provide empty body?). I'm bringing curl here because I have to implement an API that allows this:

curl -X POST -u admin:admin \ 'http://localhost:7180/api/v1/clusters/Cluster%201%20-%20CDH4/services/my_hbase/commands/hbaseCreateRoot'

Comment #1

Posted on Mar 3, 2013 by Massive Bear

Yup, that's a valid problem. Apologies for the horrible delay on fixing this.

Status: Fixed

Labels:
Type-Defect Priority-Medium