lib/nsisam/fake_server.rb in nsisam-0.7.5 vs lib/nsisam/fake_server.rb in nsisam-0.7.6

- old
+ new

@@ -11,11 +11,11 @@ def generate_key rand.to_s end - put "/" do + post "/" do content_type :json incoming = JSON.parse(request.body.read) key = generate_key storage[key] = incoming['value'] unless incoming.has_key? 'expire' { key: key, checksum: "0" }.to_json @@ -39,19 +39,19 @@ return 404 unless storage.has_key?(key) storage.delete(key) { deleted: true }.to_json end - post "/" do + put "/" do content_type :json incoming = JSON.parse(request.body.read) expire = incoming['expire'] key = incoming["key"] return 404 unless storage.has_key?(key) if incoming.has_key? 'expire' storage.delete(key) else - storage[key] = incoming['value'] + storage[key] = incoming['value'] end { key: key, checksum: 0 }.to_json end end