From b7e596a7be0e3aa0e170a83b68e9cb0da045e838 Mon Sep 17 00:00:00 2001 From: Fayland Date: Tue, 14 Oct 2014 05:59:01 +0000 Subject: [PATCH] from our live code --- lib/CouchDB/Client.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/CouchDB/Client.pm b/lib/CouchDB/Client.pm index 69f06b1..861e2cd 100644 --- a/lib/CouchDB/Client.pm +++ b/lib/CouchDB/Client.pm @@ -4,7 +4,7 @@ package CouchDB::Client; use strict; use warnings; -our $VERSION = '0.09'; +our $VERSION = '0.10'; use JSON::Any qw(XS JSON DWIW); use LWP::UserAgent qw(); @@ -83,8 +83,11 @@ sub req { if (ref $content) { $content = encode('utf-8', $self->{json}->encode($content)); - $headers = HTTP::Headers->new('Content-Type' => 'application/json'); + $headers = HTTP::Headers->new('Content-Type' => 'application/json'); } + else { + $headers = HTTP::Headers->new('Content-Length' => 0); + } my $res = $self->{ua}->request( HTTP::Request->new($meth, $self->uriForPath($path), $headers, $content) ); my $ret = { status => $res->code,