diff --git a/app/controllers/test/fake_s3_controller.rb b/app/controllers/test/fake_s3_controller.rb index a8f2ef1d51d..7d59e4ee469 100644 --- a/app/controllers/test/fake_s3_controller.rb +++ b/app/controllers/test/fake_s3_controller.rb @@ -20,7 +20,7 @@ def show end end - def create + def update key = params[:key] self.class.data[key] = request.body.read diff --git a/app/javascript/packages/document-capture/higher-order/with-background-encrypted-upload.jsx b/app/javascript/packages/document-capture/higher-order/with-background-encrypted-upload.jsx index 1380c6041a3..3fe147bc796 100644 --- a/app/javascript/packages/document-capture/higher-order/with-background-encrypted-upload.jsx +++ b/app/javascript/packages/document-capture/higher-order/with-background-encrypted-upload.jsx @@ -63,7 +63,7 @@ const withBackgroundEncryptedUpload = (Component) => ({ onChange, ...props }) => ) .then((encryptedValue) => window.fetch(url, { - method: 'POST', + method: 'PUT', body: encryptedValue, headers: { 'Content-Type': 'application/octet-stream' }, }), diff --git a/config/routes.rb b/config/routes.rb index ecb1ee551d7..610633dbf9f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -157,7 +157,7 @@ delete '/telephony' => 'telephony#destroy' get '/s3/:key' => 'fake_s3#show', as: :fake_s3 - post '/s3/:key' => 'fake_s3#create' + put '/s3/:key' => 'fake_s3#update' end end diff --git a/spec/controllers/fake_s3_controller_spec.rb b/spec/controllers/fake_s3_controller_spec.rb index 89a4468bb7b..09a0aeeaabd 100644 --- a/spec/controllers/fake_s3_controller_spec.rb +++ b/spec/controllers/fake_s3_controller_spec.rb @@ -30,9 +30,9 @@ end end - describe '#create' do + describe '#update' do subject(:action) do - post :create, body: data, params: { key: key } + post :update, body: data, params: { key: key } end it 'stores the data in memory' do diff --git a/spec/javascripts/packages/document-capture/higher-order/with-background-encrypted-upload-spec.jsx b/spec/javascripts/packages/document-capture/higher-order/with-background-encrypted-upload-spec.jsx index 0b8c4a88b56..3db7c4fc938 100644 --- a/spec/javascripts/packages/document-capture/higher-order/with-background-encrypted-upload-spec.jsx +++ b/spec/javascripts/packages/document-capture/higher-order/with-background-encrypted-upload-spec.jsx @@ -137,7 +137,7 @@ describe('document-capture/higher-order/with-background-encrypted-upload', () => expect(await patch.foo_image_url).to.equal('about:blank'); const [url, params] = window.fetch.getCall(0).args; expect(url).to.equal('about:blank'); - expect(params.method).to.equal('POST'); + expect(params.method).to.equal('PUT'); expect(params.body).to.be.instanceOf(ArrayBuffer); const bodyAsString = String.fromCharCode.apply(null, new Uint8Array(params.body)); expect(bodyAsString).to.not.equal('bar');