* @method delete * @async * @param {WPRequest} wpreq A WPRequest query object * @param {Object} [data] Data to send along with the DELETE request * @param {Function} [callback] A callback to invoke with the results of the DELETE request * @returns {Promise} A promise to the results of the HTTP
( wpreq, data, callback )
| 335 | * @returns {Promise} A promise to the results of the HTTP request |
| 336 | */ |
| 337 | function _httpDelete( wpreq, data, callback ) { |
| 338 | if ( ! callback && typeof data === 'function' ) { |
| 339 | callback = data; |
| 340 | data = null; |
| 341 | } |
| 342 | checkMethodSupport( 'delete', wpreq ); |
| 343 | const url = wpreq.toString(); |
| 344 | let request = _auth( agent.del( url ), wpreq._options, true ).send( data ); |
| 345 | request = _setHeaders( request, wpreq._options ); |
| 346 | |
| 347 | return invokeAndPromisify( request, callback, returnBody.bind( null, wpreq ) ); |
| 348 | } |
| 349 | |
| 350 | /** |
| 351 | * @method head |
nothing calls this directly
no test coverage detected