Skip to content

Instantly share code, notes, and snippets.

@SlivTaMere
Last active September 14, 2021 18:53
Show Gist options
  • Save SlivTaMere/3bc5b176a0c32cfdf5b9bb70692409fa to your computer and use it in GitHub Desktop.
Save SlivTaMere/3bc5b176a0c32cfdf5b9bb70692409fa to your computer and use it in GitHub Desktop.
How to send body in DELETE request with Apache Fluent (NSFW)
Request r = Request.Delete("http://url.com");
//disgusting hack because Fluent doesn't accept body in DELETE requests.
//Manually set default headers to ensure they are at the begining
r.addHeader("Host", "url.com");
r.addHeader("Connection", "Keep-Alive");
r.addHeader("User-Agent", "Apache-HttpClient/4.5.2 (Java/1.8.0_131)");
r.addHeader("Content-Length", ""+body.length());
r.addHeader("Accept-Encoding", "gzip,deflate");
//Add random header at the end with a valid value(else the header is not added)
r.addHeader("HackFkinFluent", "tmp");
//Modify the header with two \r\n to make it a body.
r.setHeader("HackFkinFluent", "tmp\r\n\r\n"+body);
//Throw-up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment