Respond with plaintext when user not found in changeset query

The response used to be of type xml with empty body, which is not valid xml.
This commit is contained in:
Anton Khorev 2023-08-19 20:22:19 +03:00
parent 406d90c5c8
commit 0bd5838f51
2 changed files with 3 additions and 1 deletions

View file

@ -307,7 +307,7 @@ module Api
# user input checking, we don't have any UIDs < 1
raise OSM::APIBadUserInput, "invalid user ID" if user.to_i < 1
u = User.find(user.to_i)
u = User.find_by(:id => user.to_i)
else
u = User.find_by(:display_name => name)
end

View file

@ -1863,8 +1863,10 @@ module Api
# not found when looking for changesets of non-existing users
get changesets_path(:user => User.maximum(:id) + 1)
assert_response :not_found
assert_equal "text/plain", @response.media_type
get changesets_path(:display_name => " ")
assert_response :not_found
assert_equal "text/plain", @response.media_type
# can't get changesets of user 1 without authenticating
get changesets_path(:user => private_user.id)