From: Gisle Aas 

  On Mon, May 25, 2015 at 7:46 PM, Octavian Rasnita <orasn...@gmail.com> wrote:

    Hello,

    I set 2 default headers using default_header() method and one of them is 
"Content-Type" which is set to "application/json", but it looks that it is 
overidden with "application/x-www-form-urlencoded" when doing a POST request. 
Is this intentionally?



  It's a consequence of how HTTP::Request::Common::POST() currently works; 
$ua->post() is just a thin wrapper for that function.  I guess POST() could 
have been changed to not set the "Content-Type" if passed scalar "Content".  It 
currently defaults to "application/x-www-form-urlencoded" which cause the outer 
default to not apply.  Changing this has the potential to break other code so 
it might be better to accept this behaviour.


  Regards,
  Gisle



  Thanks Gisle. So there are historical reasons.
  I will create another wrapper in my code that sets that default Content-Type 
just once.

  --Octavian

Reply via email to