1

I'm using jax-rs library to create a client testing a Web Service by sending HTTP requests to it, for study purposes. Now a POST Request looks something like this:

Response res = target.
                request().post(Entity.entity(jinput.toString(), MediaType.APPLICATION_JSON));

and GET Request something like this:

Response res = target.
            request().accept(MediaType.APPLICATION_JSON).get(Response.class);

Where target is the targeted URI and jinput the JSON Input used to post a resource...

Now I wonder... is there a way I can send a GET Request accompanied with a JSON input? For the sake of testing how the Web Service reacts to it...

By using cURL to manually send HTTP requests I can do it... but is there a way I can do it using the jax-rs library?

Thanks in advance :)

P.S. I would like to test the same thing with a DELETE Request as well... if possible...

sschrass
  • 7,014
  • 6
  • 43
  • 62
T. Kofidis
  • 57
  • 6
  • 3
    Interesting read on this topic: https://stackoverflow.com/questions/978061/http-get-with-request-body Bottom line: one should not Get with an entity attached. – sschrass Jul 30 '17 at 10:23

0 Answers0