Test sending of HTTP POST requests. @throws Exception exception
()
| 75 | * @throws Exception exception |
| 76 | */ |
| 77 | @Test public final void putPost() throws Exception { |
| 78 | // PUT - query |
| 79 | try(QueryProcessor qp = new QueryProcessor(_HTTP_SEND_REQUEST.args( |
| 80 | " <http:request method='put' status-only='true'>" |
| 81 | + "<http:body media-type='text/xml'>" + BOOKS + "</http:body>" |
| 82 | + "</http:request>", REST_URL), ctx)) { |
| 83 | checkResponse(qp.value(), 1, 201); |
| 84 | } |
| 85 | |
| 86 | // POST - query |
| 87 | try(QueryProcessor qp = new QueryProcessor(_HTTP_SEND_REQUEST.args( |
| 88 | " <http:request method='post'>" |
| 89 | + "<http:body media-type='application/xml'>" |
| 90 | + "<query xmlns='" + QueryText.BASEX_URL + "/rest'>" |
| 91 | + "<text><![CDATA[<x>1</x>]]></text>" |
| 92 | + "</query>" |
| 93 | + "</http:body>" |
| 94 | + "</http:request>", REST_URL), ctx)) { |
| 95 | checkResponse(qp.value(), 2, 200); |
| 96 | } |
| 97 | |
| 98 | // Execute the same query but with content set from $bodies |
| 99 | try(QueryProcessor qp = new QueryProcessor(_HTTP_SEND_REQUEST.args( |
| 100 | " <http:request method='post'>" |
| 101 | + "<http:body media-type='application/xml'/>" |
| 102 | + "</http:request>", |
| 103 | REST_URL, |
| 104 | " <query xmlns='" + QueryText.BASEX_URL + "/rest'>" |
| 105 | + "<text><![CDATA[<x>1</x>]]></text>" |
| 106 | + "</query>"), ctx)) { |
| 107 | checkResponse(qp.value(), 2, 200); |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * Test sending of HTTP GET requests. |
nothing calls this directly
no test coverage detected