The same issue is faced by me,
And I've noticed even after having error in Azure portal, The same code executes fine in other environments like VS Code, or postman website,
and even it gives expected result after implementing it in ADF pipeline.
This could be backend issue of Azure or may be something else, but somehow the code function in required manner and gives us the expected output.
The HttpResponse() require string as a return output and may be it faces some issue during the conversion of integer to string.