initial commit

This commit is contained in:
Dylan Knutson
2024-04-23 09:47:36 -07:00
commit 37cc74bfd1
7 changed files with 2592 additions and 0 deletions

BIN
test/cat1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

29
test/test.rb Normal file
View 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