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

Method get

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

Test sending of HTTP GET requests. @throws Exception exception

()

Source from the content-addressed store, hash-verified

113 * @throws Exception exception
114 */
115 @Test public final void get() throws Exception {
116 // GET1 - just send a GET request
117 try(QueryProcessor qp = new QueryProcessor(_HTTP_SEND_REQUEST.args(
118 " <http:request method='get' href='" + REST_ROOT + "'/>"), ctx)) {
119 final Value value = qp.value();
120 checkResponse(value, 2, 200);
121
122 assertEquals(NodeType.DOCUMENT, value.itemAt(1).type);
123 }
124
125 // GET2 - with override-media-type='text/plain'
126 try(QueryProcessor qp = new QueryProcessor(_HTTP_SEND_REQUEST.args(
127 " <http:request method='get' override-media-type='text/plain'/>", REST_ROOT), ctx)) {
128 final Value value = qp.value();
129 checkResponse(value, 2, 200);
130
131 assertEquals(BasicType.STRING, value.itemAt(1).type);
132 }
133
134 // Get3 - with status-only='true'
135 try(QueryProcessor qp = new QueryProcessor(_HTTP_SEND_REQUEST.args(
136 " <http:request method='get' status-only='true'/>", REST_ROOT), ctx)) {
137 checkResponse(qp.value(), 1, 200);
138 }
139 }
140
141 /**
142 * Test sending of HTTP DELETE requests.

Callers

nothing calls this directly

Calls 5

checkResponseMethod · 0.95
itemAtMethod · 0.95
assertEqualsMethod · 0.80
argsMethod · 0.65
valueMethod · 0.45

Tested by

no test coverage detected