Skip to content

Commit

Permalink
Update chunked_uploads to handle 202 responses (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
monkseal authored Aug 2, 2024
1 parent 4620c30 commit 3c56d55
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/boxr/chunked_uploads.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def chunked_upload_create_session_new_file_from_io(io, parent, name)

uri = "#{UPLOAD_URI}/files/upload_sessions"
body = {folder_id: parent_id, file_size: io.size, file_name: name}
session_info, response = post(uri, body, content_type: "application/json")
session_info, response = post(uri, body, content_type: "application/json", success_codes: [200,201,202])

session_info
end
Expand All @@ -31,7 +31,7 @@ def chunked_upload_create_session_new_version_from_io(io, file, name)
file_id = ensure_id(file)
uri = "#{UPLOAD_URI}/files/#{file_id}/upload_sessions"
body = {file_size: io.size, file_name: name}
session_info, response = post(uri, body, content_type: "application/json")
session_info, response = post(uri, body, content_type: "application/json", success_codes: [200,201,202])

session_info
end
Expand Down Expand Up @@ -60,7 +60,7 @@ def chunked_upload_part_from_io(io, session_id, content_range)

uri = "#{UPLOAD_URI}/files/upload_sessions/#{session_id}"
body = data
part_info, response = put(uri, body, process_body: false, digest: digest, content_type: "application/octet-stream", content_range: range)
part_info, response = put(uri, body, process_body: false, digest: digest, content_type: "application/octet-stream", content_range: range, success_codes: [200,201,202])

part_info.part
end
Expand Down Expand Up @@ -99,7 +99,7 @@ def chunked_upload_commit_from_io(io, session_id, parts, content_created_at: nil
parts: parts,
attributes: attributes
}
commit_info, response = post(uri, body, process_body: true, digest: digest, content_type: "application/json", if_match: if_match, if_non_match: if_non_match)
commit_info, response = post(uri, body, process_body: true, digest: digest, content_type: "application/json", if_match: if_match, if_non_match: if_non_match, success_codes: [200,201,202])

commit_info
end
Expand Down
2 changes: 1 addition & 1 deletion lib/boxr/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Boxr
VERSION = "1.21.0".freeze
VERSION = "1.21.1".freeze
end

0 comments on commit 3c56d55

Please sign in to comment.