Then when I test it in postman, I do get a 204, but nothing is printed (Ideally it should print “test 204” in this case). So not sure if there is a way to solve this? to print something when returning 204? Thanks!
Ah yes, 204 means “No Content”. So writing some content to the HTTP body will not give you the expected result. Use the status code 200 or 201 (depending on the context) instead.