mirror of
https://github.com/jnunemaker/httparty
synced 2023-03-27 23:23:07 -04:00
Support ActionDispatch::Http::UploadedFile again
Using the `path` method instead of passing the file directly to `File.basename` to get the filename ensures that `ActionDispatch::Http::UploadedFile` can be used again. Related issue: https://github.com/jnunemaker/httparty/issues/584
This commit is contained in:
parent
db8df8c58b
commit
0719036378
2 changed files with 5 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
## Unreleased
|
||||
|
||||
* [Support ActionDispatch::Http::UploadedFile again](https://github.com/jnunemaker/httparty/pull/585)
|
||||
|
||||
## 0.16.1
|
||||
|
||||
* [Parse content with application/hal+json content type as JSON](https://github.com/jnunemaker/httparty/pull/573)
|
||||
|
|
|
@ -32,7 +32,7 @@ module HTTParty
|
|||
multipart = normalized_params.inject('') do |memo, (key, value)|
|
||||
memo += "--#{boundary}\r\n"
|
||||
memo += %(Content-Disposition: form-data; name="#{key}")
|
||||
memo += %(; filename="#{File.basename(value)}") if file?(value)
|
||||
memo += %(; filename="#{File.basename(value.path)}") if file?(value)
|
||||
memo += "\r\n"
|
||||
memo += "Content-Type: application/octet-stream\r\n" if file?(value)
|
||||
memo += "\r\n"
|
||||
|
|
Loading…
Reference in a new issue