Skip to content

Commit c615b83

Browse files
committed
Rack 3 / Sinatra 4 upgrade: Rewind body before reading
1 parent d8fb6bc commit c615b83

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

app/controllers/internal/staging_completion_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ def prometheus_updater
121121
attr_reader :stagers
122122

123123
def read_body
124-
payload = body.read
124+
request.body.rewind
125+
payload = request.body.read
125126
Oj.load(payload, symbol_keys: true)
126127
rescue StandardError => e
127128
logger.error('diego.staging.parse-error', payload: payload, error: e.to_s)

app/controllers/internal/task_completion_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ def complete_task(task_guid, task_response)
2525
end
2626

2727
def read_body
28-
payload = body.read
28+
request.body.rewind
29+
payload = request.body.read
2930
Oj.load(payload, symbol_keys: true)
3031
rescue StandardError => e
3132
logger.error('diego.task.parse-error', payload: payload, error: e.to_s)

0 commit comments

Comments
 (0)