0

I try to do a DELETE with Net::HTTP with a proxy and a digest password. Everything is working fine without the proxy or if it's a GET.

Any ideas what I'm doing wrong and how to do it?

This code with a get is working fine.

h = Net::HTTP.new uri.host, uri.port, proxy_host, proxy_port, proxy_user, proxy_password
req = Net::HTTP::Get.new uri.request_uri
res = h.request req

The same code and replacing with a DELETE is not working

h = Net::HTTP.new uri.host, uri.port, proxy_host, proxy_port, proxy_user, proxy_password
req = Net::HTTP::Delete.new uri.request_uri
res = h.request req

I get a

#<Net::HTTPBadRequest 400 Bad Request readbody=true>

Any idea what could be the problem? Do I need to add a header or something?

Thanks

1 Answers1

0

I found my problem.

I needed to add a body for content-type.

h = Net::HTTP.new uri.host, uri.port, proxy_host, proxy_port, proxy_user, proxy_password
req = Net::HTTP::Delete.new uri.request_uri
req.body = "Content-type: application/xml"
res = h.request req

And it works now.