initial commit
This commit is contained in:
BIN
test/cat1.jpg
Normal file
BIN
test/cat1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 185 KiB |
29
test/test.rb
Normal file
29
test/test.rb
Normal file
@@ -0,0 +1,29 @@
|
||||
require "rest_client"
|
||||
|
||||
FILES = {
|
||||
cat1: -> { File.new("cat1.jpg", mode: "rb") },
|
||||
}
|
||||
|
||||
puts "response without sha256: "
|
||||
puts RestClient.post("http://localhost:7692/store", {
|
||||
content_type: "image/jpeg",
|
||||
data: FILES[:cat1].call,
|
||||
})
|
||||
|
||||
puts "response with correct sha256:"
|
||||
puts RestClient.post("http://localhost:7692/store", {
|
||||
content_type: "image/jpeg",
|
||||
sha256: "e3705544cbf2fa93e16107d1821b312a7b825fc177fa28180a9c9a9d3ae8af37",
|
||||
data: FILES[:cat1].call,
|
||||
})
|
||||
|
||||
puts "response with incorrect sha256:"
|
||||
begin
|
||||
puts RestClient.post("http://localhost:7692/store", {
|
||||
content_type: "image/jpeg",
|
||||
sha256: "123",
|
||||
data: FILES[:cat1].call,
|
||||
})
|
||||
rescue => e
|
||||
puts e.response
|
||||
end
|
||||
Reference in New Issue
Block a user