Code Monkey home page Code Monkey logo

Comments (4)

technoweenie avatar technoweenie commented on August 15, 2024

Try setting the 'Content-Length' header to 0. You're not sending a body with the PUT request.

from faraday.

dmathieu avatar dmathieu commented on August 15, 2024

Awesome, it works (note to anyone seeing this : the length should be a string, not an integer).

Would it be thinkable to add it automatically in faraday ?

from faraday.

technoweenie avatar technoweenie commented on August 15, 2024

I don't hate the idea. The behavior would have to be tested for each adapter. I believe they already set the Content-Length header if you pass a body. I don't want to do extra work in Faraday.

from faraday.

mislav avatar mislav commented on August 15, 2024

I've seen this error when running current live tests. I haven't investigated which adapter causes thisโ€”it seems to me that Net::HTTP takes care of this automatically:

def send_request_with_body(sock, ver, path, body)
  self.content_length = body.bytesize
  delete 'Transfer-Encoding'
  supply_default_content_type
  write_header sock, ver, path
  sock.write body
end

So it must be some other adapter. Not sure if this is Faraday's responsibility.

from faraday.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.