It shouldn’t matter if Ruby converts the username into the grammatically correct lowercase version of the username as long as it always looks up users with the normalized username (User.normalize_username in Ruby) and the username_lower in the database.
Which JSON fetch fails? It’s quite likely that there’s a route that uses a different mechanism for comparing usernames.