public void delete ( Integer expectedResponseCode ) throws IOException { HttpURLConnection conn = getUrlConnection ( ) ; try { if ( ! NetworkUtils . sendHttpDeleteRequest ( conn ) ) { throw new IOException ( "Failed to send delete request to " + endpointURI ) ; } // Check the response code if ( ! NetworkUtils . checkHttpResponseCode ( conn , expectedResponseCode ) ) { throw new IOException ( "Unexpected response from connection. Expected " + expectedResponseCode + " but received " + conn . getResponseCode ( ) ) ; } } finally { conn . disconnect ( ) ; } }
Make a DELETE request to a URI