From fd3974967cdd356974e6f7737f0b255b703d5229 Mon Sep 17 00:00:00 2001 From: Rob Zolkos Date: Fri, 17 Apr 2026 09:07:21 -0400 Subject: [PATCH 1/2] Return the updated user on PUT /:account_slug/users/:user_id The JSON response was `204 No Content`, forcing clients to follow up with a GET. The Smithy contract the SDKs are generated from already declares `UpdateUser` returns a User, so the server was out of sync with the documented shape. Render `show` for the JSON format so PUT returns the same payload as GET. The HTML redirect behavior is unchanged. Only name and avatar are accepted on this endpoint, neither of which affects the acting user's access, so no access-check branch is needed. Updated test asserts the returned body matches the updated state. Updated API docs to describe the 200 response shape. --- app/controllers/users_controller.rb | 2 +- docs/api/sections/users.md | 2 +- test/controllers/users_controller_test.rb | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index fdc528d3e9..e77f3d4b12 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -18,7 +18,7 @@ def update if @user.update(user_params) respond_to do |format| format.html { redirect_to @user } - format.json { head :no_content } + format.json { render :show } end else respond_to do |format| diff --git a/docs/api/sections/users.md b/docs/api/sections/users.md index 0d4d2889a2..6af8e88c2c 100644 --- a/docs/api/sections/users.md +++ b/docs/api/sections/users.md @@ -88,7 +88,7 @@ __Request:__ __Response:__ -Returns `204 No Content` on success. +Returns `200 OK` with the updated user in the same shape as `GET /:account_slug/users/:user_id`. ## `DELETE /:account_slug/users/:user_id/avatar` diff --git a/test/controllers/users_controller_test.rb b/test/controllers/users_controller_test.rb index 7fd9fd28da..dcadefccec 100644 --- a/test/controllers/users_controller_test.rb +++ b/test/controllers/users_controller_test.rb @@ -120,8 +120,12 @@ class UsersControllerTest < ActionDispatch::IntegrationTest put user_path(users(:david)), params: { user: { name: "New David" } }, as: :json - assert_response :no_content + assert_response :success assert_equal "New David", users(:david).reload.name + + json = @response.parsed_body + assert_equal users(:david).id, json["id"] + assert_equal "New David", json["name"] end test "update as JSON with invalid avatar returns errors" do From 7f108a440591bec74cc39c758f17dd286129ec97 Mon Sep 17 00:00:00 2001 From: Rob Zolkos Date: Fri, 17 Apr 2026 09:35:45 -0400 Subject: [PATCH 2/2] Update flat JSON user response test for 200 body MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mirrors the nested-params test in users_controller_test.rb — flat JSON PUTs now return the updated user as the body instead of 204 No Content. --- test/controllers/api/flat_json_params_test.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/controllers/api/flat_json_params_test.rb b/test/controllers/api/flat_json_params_test.rb index 77a74f454e..4f847b1068 100644 --- a/test/controllers/api/flat_json_params_test.rb +++ b/test/controllers/api/flat_json_params_test.rb @@ -184,8 +184,10 @@ class FlatJsonParamsTest < ActionDispatch::IntegrationTest test "update user with flat JSON" do put user_path(users(:david)), params: { name: "Flat Name" }, as: :json - assert_response :no_content + assert_response :success assert_equal "Flat Name", users(:david).reload.name + assert_equal users(:david).id, @response.parsed_body["id"] + assert_equal "Flat Name", @response.parsed_body["name"] end test "create webhook with flat JSON" do