Azure / azure-ruby-asm-core

Azure Ruby SDK Service Management Core HTTP
6 stars 32 forks source link

HttpRequest throws exception when the body is an IO object #29

Open yaxia opened 7 years ago

yaxia commented 7 years ago

HttpRequest throws exception when the body is an IO object, because the code checks whether the body is an IO object but it actually uses the APIs of the File(derived from the IO object): body.size and body.path.

I am going to make a change to fix it. Here are some questions for discussion:

  1. Shall we support File object only? Is it by-design?
  2. Regarding API convenience, an IO or StringIO object may also be the body, shall we support it?

Thoughts? @vishrutshah , @veronicagg

vishrutshah commented 7 years ago

@yaxia Thank you very much for bringing this up.

Using properties of File class with checks on IO class seems like a bug. I think we should support most possible scenarios for IO as you mentioned IO, File and StringIO as of now.

What are your views?