MCPcopy Create free account
hub / github.com/BaseXdb/basex / putDelete

Method putDelete

basex-api/src/test/java/org/basex/http/FnHttpTest.java:145–165  ·  view source on GitHub ↗

Test sending of HTTP DELETE requests. @throws Exception exception

()

Source from the content-addressed store, hash-verified

143 * @throws Exception exception
144 */
145 @Test public final void putDelete() throws Exception {
146 // add document to be deleted
147 try(QueryProcessor qp = new QueryProcessor(_HTTP_SEND_REQUEST.args(
148 " <http:request method='put'>"
149 + "<http:body media-type='text/xml'><ToBeDeleted/></http:body>"
150 + "</http:request>", REST_URL), ctx)) {
151 qp.value();
152 }
153
154 // DELETE
155 try(QueryProcessor qp = new QueryProcessor(_HTTP_SEND_REQUEST.args(
156 " <http:request method='delete' status-only='true'/>", REST_URL), ctx)) {
157 checkResponse(qp.value(), 1, 200);
158 }
159
160 // DELETE (same resource, empty sequence as body, 404 expected)
161 try(QueryProcessor qp = new QueryProcessor(_HTTP_SEND_REQUEST.args(
162 " <http:request method='delete'/>", REST_URL, " ()") + "[1]/@status/data()", ctx)) {
163 assertEquals("404", qp.value().serialize().toString());
164 }
165 }
166
167 /**
168 * Test sending of HTTP request without any attributes - error shall be thrown

Callers

nothing calls this directly

Calls 6

checkResponseMethod · 0.95
assertEqualsMethod · 0.80
argsMethod · 0.65
toStringMethod · 0.65
valueMethod · 0.45
serializeMethod · 0.45

Tested by

no test coverage detected